I have a bash script I'd like to run at boot (both reboot and from cold boot) using the latest Ubuntu server version.
I've confirmed the script works when running it directly.
I ran
sudo crontab -e
and added the following to the file
@reboot ./wol.sh
I've confirmed that the script runs successfully when I run it myself using
sudo ./wol.sh
but it doesn't run when I restart Ubuntu with
sudo shutdown -r now
If it's relevant here's the bash file
#!/bin/bash
etherwake MAC_ADDRESS -i enp1s0
I also set the permissions to the file as chmod 700
What am I missing? Thanks in advance.
/path/to/script
when running from cron, and not./script
. This is also stated in the duplicate Q&A above. – Artur Meinild Apr 14 '22 at 14:39