Get the latest tech news
Cron Jobs on Linux – Comprehensive Guide with Examples
SysAdmin Stuff | Linux | Network | Security
Save a script in one of the following directories to run it directly as root and system-wide and the schedule you want: Active cron job for a command or script: 0 */12 * * * /path/to/backup.sh# runs a backup script every 12 hours 0 */12 * * * rsync -avh /source/ /destination/# runs a backup command every 12 hours A declaration of an environment variable for the following cron jobs: result="HELLO WORLD" A comment taht starts the line with a hash#, that is ignored by cron:# just a comment Or an empty line, which is also ignored: Side note: it is recommended to use absolute paths for all scripts or executables. Side note: I’ve read that it works for Ubuntu and rockyOS, but I only tested it successfully on rockOS.
Or read this on Hacker News