Cron
Chester Wyke December 07, 2022 Updated: April 15, 2025 #debian
debian (Series)
MAC Address Change
Set permissions recursively on directory structure
Touch (Set file modified date)
Android Apps on Linux
Blacklist Module
Calender Notifications Popup Disable
CUPS PDF Printer
gping
Hide Mounts
Nautilus
Power
Smartgit
Video Cards
Snapcraft
Acrobat Reader
Audio
Shortcuts (Important)
DNS
Mounting Drives
Setup Network Shares
Cron
Startup
Users and Groups
Paths to remember
Manually Removing Old Kernels
Set Icon for Application
Strange Problems and Fixes
Redirecting stderr
Extensions
Ubuntu Software
Show Seconds on Clock Display
Create Bootable Flash Drive
Compressed Files
services systemd (unit)
SCP
SSH
Updating
Useful commands
Firewall
View Whitespace
OpenVPN
PPP logs
MAN
Terminal
sed
Characters
zsh
Links between files
7z encrypted file
Wayland or x11?
Delete Old Files Automatically
MAC Address Change
Set permissions recursively on directory structure
Touch (Set file modified date)
Android Apps on Linux
Blacklist Module
Calender Notifications Popup Disable
CUPS PDF Printer
gping
Hide Mounts
Nautilus
Power
Smartgit
Video Cards
Snapcraft
Acrobat Reader
Audio
Shortcuts (Important)
DNS
Mounting Drives
Setup Network Shares
Cron
Startup
Users and Groups
Paths to remember
Manually Removing Old Kernels
Set Icon for Application
Strange Problems and Fixes
Redirecting stderr
Extensions
Ubuntu Software
Show Seconds on Clock Display
Create Bootable Flash Drive
Compressed Files
services systemd (unit)
SCP
SSH
Updating
Useful commands
Firewall
View Whitespace
OpenVPN
PPP logs
MAN
Terminal
sed
Characters
zsh
Links between files
7z encrypted file
Wayland or x11?
Delete Old Files Automatically
Source: https://www.cyberciti.biz/faq/how-do-i-add-jobs-to-cron-under-linux-or-unix-oses/
Open file to edit
Format
a b c d e /path/command
a
: Minute (0-59)b
: Hours (0-23)c
: Day (0-31)d
: Month (0-12 [12 == December])e
: Day of the week(0-7 [7 or 0 == sunday])/path/command
– Script or command name to schedule
Options other than number
Source: https://crontab.guru/every-5-minutes
*
: any value,
: value list separator-
: range of values/
: step values
Example every 5 minutes
*/5 * * * * date >> ~/date.txt
Special @ shortcuts
Source: https://www.linode.com/docs/guides/schedule-tasks-with-cron/#special-cron-syntaxes
@reboot
statement runs the specified command once, at start up.@yearly
and@annually
both run the specified task every year at 12:00am on the 1st of January. This is equivalent to specifying0 0 1 1 *
in the crontab line.@daily
and@midnight
both run the cronjob every day at 12:00am. This is equivalent to the following cron syntax:0 0 * * *
.@monthly
runs the job once a month, on the 1st, at 12:00am. In standard cron syntax this is equivalent to:0 0 1 * *
.@weekly
runs the job once a week at 12:00am on Sunday. This is the same as specifying0 0 * * 0
on the crontab line.@hourly
runs the job at the top of every hour. In standard cron syntax this is equivalent to:0 * * * *
.
Example Usage
@reboot date >> ~/test_cron.txt
Test Cron
Simple Test
Open Crontab
Add line to bottom and save (Ensure there is a new line at the end of the line)
* * * * * date >> ~/date.txt
Wait one minute and confirm that it works
More involved test that uses a script
Overview: Create test script and set cron to run script
Create temp folder
Create test script
Open Crontab
Add line to bottom and save (Ensure there is a new line at the end of the line)
* * * * * ~/tmp/cron_test.sh
Wait one minute and confirm that it works