Tuesday, June 11, 2019

cron - Does Ubuntu support "@reboot" in crontab?

Does Ubuntu support @reboot in crontab?



I find documentation suggesting it is supported, but web chatter asserts it is not.




I cannot make the @reboot section work.
The "after midnight" section works fine.



Here is the test example from my /etc/crontab:





$ cat /etc/crontab
# /etc/crontab: system-wide crontab


SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# m h dom mon dow user command
17 * * * * root cd / && run-parts --report /etc/cron.hourly
25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
#

##

# in the beginning -
@reboot /var/kiosk/btest.sh

# after midnight
30 0 * * * root /etc/cron.daily/kiosk/kioskReboot.sh

# end of crontab



shell script btest.sh



#!/bin/bash
date > /var/kiosk/STARTFLAG.txt
echo we booted >> /var/kiosk/STARTFLAG.txt
date
echo we booted



permissions





$ ls -l btest.sh
-rwxrwxrwx 1 root root 147 Aug 21 15:19 btest.sh
$ ls -ld
drwxrwxrwx 14 laptopsanytime root 4096 Aug 21 16:30 .

No comments:

Post a Comment

11.10 - Can't boot from USB after installing Ubuntu

I bought a Samsung series 5 notebook and a very strange thing happened: I installed Ubuntu 11.10 from a usb pen drive but when I restarted (...