Skip to content

Instantly share code, notes, and snippets.

@MrityunjaiKumar
Last active November 3, 2016 20:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MrityunjaiKumar/809c0e4f64e3d6c8a16b9a1e1aa2d480 to your computer and use it in GitHub Desktop.
Save MrityunjaiKumar/809c0e4f64e3d6c8a16b9a1e1aa2d480 to your computer and use it in GitHub Desktop.
# * * * * * 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