Difference between revisions of "Running tasks on reboot with Cron"
From emboxit
(Created page with "*Instructions created by Karl Maxwell 27/10/2016 Type in: crontab -e This will bring up a crontab window. Enter @reboot followed by a single command to have that command exec...") |
m (1 revision) |
(No difference)
|
Latest revision as of 07:41, 26 August 2017
- Instructions created by Karl Maxwell 27/10/2016
Type in:
crontab -e
This will bring up a crontab window. Enter @reboot followed by a single command to have that command execute upon rebooting:
@reboot raspistill -o /home/pi/testImage.jpg
It is recommended that you use the full path. A single ‘&’ symbol at the end will make the command execute in the background. To run multiple commands consecutively, use ‘&&’ between commands.
@reboot cd /home/pi/apps && make run
In such a sequence, a command will only run if the previous command exits successfully. If error-checking is not required, string commands together separated with ‘:’. The changes above affect only the current user as this crontab is associated with that user. To edit the root crontab instead, use:
sudo crontab -e