Normal cron jobs (not using the @ symbol) run just fine.
For testing purposes, I have set up a command to be run echo "hi" > /home/kasperfred/reboot.txt which works when running from terminal, and using running as a normal cronjob with the crontab command:
* * * * * echo "hi" > /home/kasperfred/reboot.txt
But the following command doesn't work:
@reboot echo "hi" > /home/kasperfred/reboot.txt
When using sudo reboot to reboot, no reboot.txt is written, however, syslog logs the command as successfully run.
From syslog:
Jun 11 14:30:03 zeus cron[2224]: (CRON) INFO (pidfile fd = 3)
Jun 11 14:30:03 zeus cron[2224]: (CRON) INFO (Running @reboot jobs)
Jun 11 14:30:03 zeus CRON[2266]: (kasperfred) CMD (echo "hi" > /home/kasperfred/reboot.txt)
What am I doing wrong, and if this cannot be solved, what alternatives are there for running scripts at boot time?
I'm using Ubuntu Server 16.04 LTS.