You are not logged in.

#1 2013-01-28 15:21:31

Fio87
Member
Registered: 2012-12-25
Posts: 8

How to send wol packet before mounting shares when booting?

I have some shares (smb) that I want to mount on boot. My NAS is set to fall asleep after some time to save energy but can be woken up with wol. Is there a way to automatically send a wol packet to my nas before mounting the shares when booting? If so, how would I do that?

Offline

#2 2013-01-28 16:57:36

chris_l
Member
Registered: 2010-12-01
Posts: 390

Re: How to send wol packet before mounting shares when booting?

Here is an idea. Btw, I don't have samba on my pcs neither I haven't used (yet) systemd.mount so there is a lot of speculation here smile

You can mount filesystems using systemd. Check man systemd.mount for more info.

But, assuming is possible to mount samba shares with systemd.mount, and that you can add a Before statement on them, requiring a service, you could add Before=wol.service

And wol.service would be a oneshot unit that will call an script that sends a wol package to the destiny machine and then pings to it. If the other machine responds the ping, the script ends. If not, then sleep for some seconds and then repeat. That way, it will not end until the other machine is answering, and then, the samba systemd mount will do its stuff.

...lots of guessing, I know. But hey, I haven't used systemd.mounts yet.

If you try it, let know how things turn out!


"open source is about choice"
No.
Open source is about opening the source code complying with this conditions, period. The ability to choose among several packages is just a nice side effect.

Offline

Board footer

Powered by FluxBB