Linux - Cron Jobs for Scheduled Tasks (crontab)
Eli the Computer Guy Eli the Computer Guy
1.05M subscribers
25,613 views
0

 Published On Sep 24, 2019

Find code and diagrams at: https://www.EliTheComputerGuy.com

Cron Jobs are automated tasks that you can create in Linux to do such things as delete cache files or run antivirus scans. You simply set when you want the task to run and then type the full command with options.

Notes:

Each user has their own crontab file including root.
Cron Jobs will have the permissions of the user they are associated with
If you accidentally simply Type crontab with no options to exit Type – Control x c together
Crontab Editing and Viewing

crontab -e – Edit crontab file for logged in user
sudo crontab -e – Edit crontab file for root
rm ~/.selected_editor – Resets default crontab editor option
crontab -l – Allows you to view crontab file for logged in user
crontab -u username -l – Allows you to view crontab file for other user
Crontab Scheduling

Format = Minute Hour Day Month DayofWeek Command
* * * * * touch /home/bob/cronTestFile = Will touch cronTestFile every minute
00 01 * * * touch /home/bob/cronTestFile = Will touch cronTestFile at 1am every morning
https://crontab.guru – Explains scheduling and has interactive tool

show more

Share/Embed