@reboot commands are not being run from cron. I verified this with
grep cron /var/log/syslog
which showed
Jul 25 16:17:01 picam2 /USR/SBIN/CRON[4487]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Jul 25 17:17:01 picam2 /USR/SBIN/CRON[4497]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Jul 25 18:17:01 picam2 /USR/SBIN/CRON[4507]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Jul 25 19:17:01 picam2 /USR/SBIN/CRON[4623]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Jul 25 19:35:21 picam2 crontab[4714]: (root) BEGIN EDIT (root)
Jul 25 19:36:03 picam2 crontab[4714]: (root) REPLACE (root)
Jul 25 19:36:03 picam2 crontab[4714]: (root) END EDIT (root)
Jul 25 19:58:06 picam2 crontab[4752]: (root) LIST (root)
cron is running
ps aux | grep cron
also setup cron logging by uncommenting the entry in /etc/rsyslog.conf but no /var/log/cron.log is created on the next boot.
From what I can see there should have been a
(CRON) INFO (Running @reboot jobs)
entry followed by
CMD my command
I found the /var/run/crond.reboot
file was created 3 days ago even though I had rebooted a number of times. After deleting it and rebooting it has not come back. I thought this was the mechanism cron used to avoid rerunning @reboot jobs?
The crontab was created with sudo and
sudo crontab -u root -l
returns
@reboot echo "hi" > /home/pi/reboot.txt 2>&1
@reboot /home/pi/launcher.sh >>/home/pi/logs/cron.log 2>&1
although it's not directly important, neither the /home/pi/reboot.txt nor the /home/pi/logs/cron.log get created on boot. Both commands work fine when run from a sudo -s
shell
New Raspian install (2015/05/05 image) with apt-get update and apt-get upgrade
Linux picam2 3.18.11+ #781 PREEMPT Tue Apr 21 18:02:18 BST 2015 armv6l GNU/Linux
"man cron" shows this the standard Vixie Cron which does support @reboot