I'm attempting to remotely wake a slave machine when the master boots up through a bash script using the etherwake command to send magic packets. Both OSs are Debian 8. The full code is written below:



# Provides: etherwake
# Required-Start: $all
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start etherwake at boot time
# Description: Enable service provided by etherwake.


case "$1" in

                echo  "Booting slaves through etherwake..."
                $ETHERWAKE <MAC Address>
                echo  "Finished booting all slaves."

                echo "Stop not implemented. Doing nothing"

                $0 stop
                sleep 10
                $0 start

                echo "Usage: /etc/init.d/etherwake {start}"
                exit 1

exit 0

After writing the script, I did:

  1. chmod 755 /etc/init.d/etherwake
  2. update-rc.d etherwake defaults
  3. Reboot the system through shutdown -r now

I've also tried using /etc/rc.local in 3 different ways:


#!/bin/sh -e
# rc.local

etherwake <MAC Address>
/usr/sbin/etherwake <MAC Address>
exit 0

No luck whatsoever. When I run either /etc/rc.local or /etc/init.d/etherwake manually as root, everything works nicely. I thought it could be something with the permissions but as far as I read any script on /etc/init.d runs as root by default. What am I doing wrong?

Thanks in advance.


I understand Debian 8 uses systemd instead of sysvinit. After setting everything upsystemctl -l status etherwake.service gives me:

● etherwake.service - Etherwake magic packet service
   Loaded: loaded (/etc/systemd/system/etherwake.service; enabled)
   Active: inactive (dead) since Fri 2016-09-30 16:30:56 BRT; 1min 33s ago
  Process: 824 ExecStart=/etc/init.d/etherwake start (code=exited, status=0/SUCCESS)
 Main PID: 824 (code=exited, status=0/SUCCESS)

Sep 30 16:30:56 hostname etherwake[824]: Booting slaves through etherwake...
Sep 30 16:30:56 hostname etherwake[824]: Finished booting all slaves.

And /etc/systemd/system/etherwake.service is:

Description=Etherwake magic packet service
After=syslog.service network.target network-online.target

ExecStart=/etc/init.d/etherwake start


Another thing I noticed is that running systemctl restart etherwake works as a charm.

  • Can you edit your question to add the output of systemctl -l status etherwake.service? – Steven Monday Sep 30 '16 at 16:07
  • Done. @StevenMonday – Gabriel Rebello Sep 30 '16 at 18:58
  • I'd guess your unit is somehow being run before the network is really up. You might be able to tell from the full log (e.g., journalctl -b). – derobert Mar 9 '17 at 16:26

The problem is that update-rc.d etherwake defaults maybe don't work. Try to enable service via systemctl, run:

systemctl enable etherwake

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.