For some testing, I need to reboot my system every minute. I have a busybox based system, installed cron using opkg. I setup a cron job using crontab, everything looks ok:
root@SL1000-1103DC:~# crontab -l # DO NOT EDIT THIS FILE - edit the master and reinstall. # (/tmp/crontab.1962 installed on Tue Jun 16 14:57:01 2015) # (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $) * * * * * /sbin/reboot root@SL1000-1103DC:~#
But the command is never run after the system boots? However, if I restart cron, then everything works:
root@SL1000-1103DC:~# /etc/init.d/cron restart Stopping Vixie-cron. Starting Vixie-cron. root@SL1000-1103DC:~# date Tue Jun 16 14:58:18 EDT 2015 root@SL1000-1103DC:~# Broadcast message from root (Tue Jun 16 14:59:00 2015): The system is going down for reboot NOW! INIT: Switching to runlevel: 6
So is there something different about running cron at startup, versus running from a command line? Maybe some subtle permissions issue? All of this is done at root level. Hmmm....
Edit: More info - looks like the unit is rebooting at odd times, as if cron was confused about the time? I left it alone, and it rebooted several times. Last time I had tail on /var/log/messages, and I see a message from cron issuing the command. So now the question is - why is cron confused about the time?