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.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of Linux

Linux

Photo of examples

examples

Photo of comprehensive guide

comprehensive guide

Related news:

News photo

AmpereOne Performance On Linux 6.11 Kernel, 4K vs. 64K Page Size Comparison

News photo

Show HN: Hacker League – Open-Source Rocket League on Linux

News photo

getrandom() vDSO Coming To More Architectures With Linux 6.12