Fill these in once
- Add the job
(crontab -l 2>/dev/null; echo "0 2 * * * /Users/me/backup.sh") | crontab -0 2 * * * means 2:00 every day. The five parts are minute, hour, day, month and weekday.
Check it worked
- List your jobs
crontab -l
Undo it
- Remove the job
crontab -l | grep -vF "/Users/me/backup.sh" | crontab -
- Add the job
(crontab -l 2>/dev/null; echo "0 2 * * * /Users/me/backup.sh") | crontab -0 2 * * * means 2:00 every day. The five parts are minute, hour, day, month and weekday.
Check it worked
- List your jobs
crontab -l
Undo it
- Remove the job
crontab -l | grep -vF "/Users/me/backup.sh" | crontab -
- Add a daily task at 2:00
schtasks /Create /SC DAILY /ST 02:00 /TN "Nightly backup" /TR "/Users/me/backup.sh"Windows uses Task Scheduler instead of cron.
Check it worked
- Check it's there
schtasks /Query /TN "Nightly backup"
Undo it
- Remove the task
schtasks /Delete /TN "Nightly backup" /F

New to cron jobs? I explain it in plain English on Layman Terms.