[Samba] Running a sleepy server (was: smbd on a battery-powered device)

Liam pubsub at networkimprov.net
Thu Dec 16 15:36:21 MST 2010


On Thu, Dec 16, 2010 at 1:52 PM, <tms3 at tms3.com> wrote:

> On Thursday 16/12/2010 at 1:36 pm, Liam wrote:
>
> On Wed, Dec 15, 2010 at 1:31 AM, Andrew Bartlett <abartlet at samba.org>
> wrote:
>
> On Mon, 2010-12-13 at 12:37 -0800, Liam wrote:
>
> I'm setting up samba service on a battery-powered WiFi device. The
> plan is to have it wake-on-lan, handle request, sleep. Anyone have
> experience with this?
>
> Are there smb protocol aspects that preclude server sleep between
> client-initiated exchanges?
>
> My server won't be awake to respond to netbios broadcasts, e.g. for
> name resolution. Can I shut off that service, and have clients access
> \\192.168.0.10\share? Can I shut off everything but the smb session
> service?
>
> Alternatively I could start/stop the server on demand, since I know
> when a client wants a file via smb. Is samba startup efficient, or
> cpu/disk-intensive?
>
>
> The inetd mode would seem to be the best way to handle this. Then your
> inetd or replacement can handle starting smbd. Just watch out that
> clients may keep a connection open for quite some time while not
> actually using it.
>
> ...
>
> And when an smb connection is active but the client is idle, does the
> client
> expect anything from the server?
>
> Well, it kinda depends on a lot of things.  But a realistic instance:  Say
> a user opens a word doc, get an oplock, then goes home for the evening.
> Well, Word expects that oplock is there, Windows expects it, and in my
> experience a Samba server maintains it...soooo....that connection would be
> open and running the next morning.
>
> That said, depending on the file type and what's oplocked etc...often
> restarting smbd does little harm...often...but it depends on the type of
> files shared.  So perhaps you could pull information from smbstatus, and
> restart smbd then sleep the server and wait for the client to decided to do
> something...again though could be quite messy, just depends on what your use
> is.
>

I don't actually need to *restart* samba, just sleep the device it's running
on. All its state would persist until the next incoming message wakes it.
But a sleepy server obviously won't send anything to the client, so I want
to make sure that's not an issue.


More information about the samba mailing list