[Samba] How to detect active users

Jeremy Allison jra at samba.org
Tue Jul 26 11:27:03 MDT 2011


On Tue, Jul 26, 2011 at 07:18:15PM +0200, Malte Forkel wrote:
> Am 26.07.2011 19:08, schrieb John Drescher:
> > On Tue, Jul 26, 2011 at 1:04 PM, Malte Forkel <malte.forkel at berlin.de> wrote:
> >> Am 26.07.2011 18:42, schrieb Chris Weiss:
> >>> On Tue, Jul 26, 2011 at 3:06 AM, Malte Forkel <malte.forkel at berlin.de> wrote:
> >>>> Currently, I'm not even sure Samba preserves the kind of state
> >>>> information required to detect the usage scenario  I'm interested in. Is
> >>>> there any concept of an "open file" in Windows/Samba, after all? May be
> >>>> it depends on the application used to open the file?
> >>>
> >>> yes, it depends on the application.  If the app closes the file and
> >>> leaves the share, samba honors that.  if the app keeps the file handle
> >>> open, samba does too.
> >>
> >> So an application (like SciTE) might open a file, read and display its
> >> contents, and close the file while continuing to display it. And in
> >> contrast, a different application might not close the file while it is
> >> displaying its contents?
> > 
> > Exactly.
> > 
> > John
> 
> Well, thanks to all of you for your help.
> 
> In summary then, it looks to me like I won't be able to reliably detect
> if there is any client out there who would be disappointed if the server
> shuts down.

Of course you will ! smbstatus does this as I keep repeating.
If an application has opened and closed the file and keeps it
in memory, then the user won't be disappointed if the server
is shut down, they'll get an IO error on save and have to
do a "save as" to a local (or other remote) drive.

If an application keeps the file open (so it's not safely
stored in memory) then smbstatus will show this and you
don't shut the server down.

You seem to think there's some "magic" option that will
show you client intent, not client activity.

Client activity is all you need to care about, and smbstatus
show you this. Doesn't matter if applications are running
or not, whether that have actual files open is all that
matters.

Jeremy.


More information about the samba mailing list