Sample Header Ad - 728x90

Startup script on Debian 8 (Jessie) with etherwake won't work

3 votes
1 answer
1434 views
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: ## /etc/init.d/etherwake ## #!/bin/sh #/etc/init.d/etherwake ### BEGIN INIT INFO # 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. ### END INIT INFO ETHERWAKE=/usr/sbin/etherwake case "$1" in start) echo "Booting slaves through etherwake..." $ETHERWAKE echo "Finished booting all slaves." ;; stop) echo "Stop not implemented. Doing nothing" ;; restart|force-reload) $0 stop sleep 10 $0 start ;; *) echo "Usage: /etc/init.d/etherwake {start}" exit 1 ;; esac 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: ## /etc/rc.local ## #!/bin/sh -e # # rc.local /etc/init.d/etherwake etherwake /usr/sbin/etherwake 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. ---------- ## Edit: ## 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: Booting slaves through etherwake... Sep 30 16:30:56 hostname etherwake: Finished booting all slaves. And /etc/systemd/system/etherwake.service is: [Unit] Description=Etherwake magic packet service Wants=network-online.target After=syslog.service network.target network-online.target [Service] ExecStart=/etc/init.d/etherwake start [Install] WantedBy=default.target Another thing I noticed is that running systemctl restart etherwake works as a charm.
Asked by Gabriel Rebello (131 rep)
Sep 30, 2016, 02:12 PM
Last activity: Jul 4, 2022, 03:07 AM