• get the mac address of the interface of the target PC(T)
  • enable wake on lan in bios of the target PC(T)
  • pace shure PC(T) has done a clean shutdown (it might be in an unkown state, so boot it up and perform clean shutdown)
  • use a different PC(D) to send the signal:

lsb_release -d
Description:	Debian GNU/Linux 11 (bullseye)

su - root
apt update
apt install etherwake
etherwake -i enp2s0 24:1c:04:xx:xx:xx

… the sleepy sleepy pc should wake up.

the story goes like this:

there are some PCs who’s BIOS performs a power on after power restore – flawlessly.

and there are some who do not.

if the user is lucky, those that do not, can be woken up via WoL

his has worked: make sure a script can be started during boot (Debian(based): rc.local or systemd (a bit more complicated = complexity is the enemy X-D))

GNU Linux -> rpm Fedora CentOS Redhat and deb Debian Ubuntu Mint (rc.local) -> LXDE/OpenBox -> How to Autostart / Startup a Script after Desktop loaded

GNU Linux -> rpm Fedora CentOS Redhat and deb Debian Ubuntu Mint (rc.local) -> LXDE/OpenBox -> How to Autostart / Startup a Script after Desktop loaded

cat /etc/rc.local 
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

# log time of startup/when rc.local was run
echo "rc.local was run at startup on $(date '+%Y-%m-%d-%H:%M:%S')" >> /var/log/startup.log;

/root/wake_up_the_others.sh &

exit 0

then go:

chmod +x /etc/rc.local;
systemctl daemon-reload;
systemctl start rc-local;
systemctl status rc-local;

please note above, the & which means: start is as a (background) job and continue the script…

the script

vim /root/wake_up_the_others.sh

looks like that: it sends a WoL to mac 24:1c:04:xx:xx:xx (there seems to be no way to send a mac broadcast to all macs in the current network?)

(but there is the etherwake -b option?)

#!/bin/bash

echo "========== waking up PC(T)... because it's bios is unable to power on on power restore $(date '+%Y-%m-%d-%H:%M:%S')" >> /var/log/startup.log;
/usr/sbin/etherwake -i eno1 24:1c:04:xx:xx:xx
sleep 3

echo "========== waking up PC(T)... because it's bios is unable to power on on power restore $(date '+%Y-%m-%d-%H:%M:%S')" >> /var/log/startup.log;
/usr/sbin/etherwake -i eno1 24:1c:04:xx:xx:xx
sleep 3

echo "========== waking up PC(T)... because it's bios is unable to power on on power restore $(date '+%Y-%m-%d-%H:%M:%S')" >> /var/log/startup.log;
/usr/sbin/etherwake -i eno1 24:1c:04:xx:xx:xx
sleep 3

the theory behind this approach is:

maybe network is not (yet) available (for whatever reasons? firewalls starting up? who knows? (that is what used to be the runlevels, right? “network available” runlevel)

Within the SystemD(aemon), runlevels are exposed as “Targets.” (src)

liked this article?

  • only together we can create a truly free world
  • plz support dwaves to keep it up & running!
  • (yes the info on the internet is (mostly) free but beer is still not free (still have to work on that))
  • really really hate advertisement
  • contribute: whenever a solution was found, blog about it for others to find!
  • talk about, recommend & link to this blog and articles
  • thanks to all who contribute!
admin