Instantly share code, notes, and snippets.

Embed
What would you like to do?
# * * * * * command to execute
# ┬ ┬ ┬ ┬ ┬
# │ │ │ │ │
# │ │ │ │ │
# │ │ │ │ └───── day of week (0 - 7) (0 to 6 are Sunday to Saturday, or use names; 7 is Sunday, the same as 0)
# │ │ │ └────────── month (1 - 12)
# │ │ └─────────────── day of month (1 - 31)
# │ └──────────────────── hour (0 - 23)
# └───────────────────────── min (0 - 59)
crontab -e
crontab -l
@reboot python /path/script.py &
#!/usr/bin/env bash
cd ~/
cd ~/scripts
sudo python targetPythonScript.py
cd ~/
chmod 755 fifteenMinlauncher.sh
@reboot sh /path/fifteenMinlauncher.sh >/pathToLogFolder/fifteenMinlauncherCronlog.log 2>&1
Examples include:
* * * * * command - runs every minute
30 * * * * command - runs every 30 minutes
30 8 * * 5 command - runs every Friday at 8:30am
*/15 * * * * [path/to/script] #every fifteen minutes
sudo service cron reload
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment