I have a server that is responsible for waking up a machine (on different days) to run backups, updates, and other chores. This is done via 'ether-wake' statements in the server /etc/crontab and works quite well that way. Because I often wish to wake a machine manually to work on it and not have to remember & type the MAC each time, I wrote a single bash script named wakeup.sh that takes a {machine name} parameter, assigns the appropriate MAC to a variable which is then used with the ether-wake command. The script works beautifully ... well, until I tried to run it from inside /etc/crontab. The script runs fine and without error (verified /var/log/cron), but the appropriate machine doesn't wake up. So, I then included an "echo" in my script
Code: Select all
echo
sudo ether-wake $MAC
echo
echo "Sent wake signal to $machineName at $MAC."
echo
Question is:
WHY, from /etc/crontab, does it all seem to not work. The very same crontab command pasted to the command line DOES wake the machine!
- crontab entries (with modified MACs and machine names) with my failing/testing entries commented:
Code: Select all
# wake-up videoBox for Tues and Sat backup(s)
20 18 * * mon root ether-wake 0a:1b:21:05:f1:17
20 18 * * fri root ether-wake 0a:1b:21:05:f1:17
## 20 18 * * mon root bash /scripts/wakeup.sh videoBox >> /mnt/4tb1/logs/wakeup.log
## 20 18 * * fri root bash /scripts/wakeup.sh videoBox >> /mnt/4tb1/logs/wakeup.log
## TESTING ENTRY
## 35 13 * * * root bash /scripts/wakeup.sh videoBox >> /mnt/4tb1/logs/wakeup.log
Code: Select all
20 18 * * mon root bash "/scripts/wakeup.sh videoBox"
Thank you.