Cron Tab
What is Cron tab or Cron Job ?
The software utility cron is a time-based job scheduler in Unix-like computer operating systems. People who set up and maintain software environments use cron to schedule jobs (commands or shell scripts) to run periodically at fixed times, dates, or intervals. It typically automates system maintenance or administration.
How to Set a cron job
1. Open terminal (ctrl+shift+t) & run below command
sudo crontab -e
if prompt for password enter your login password.
2. In the file you need to set the cron in the format of 5 *'s (five stars). The details of these 5 stars as below:
# ┌───────────── minute (0 - 59) # │ ┌───────────── hour (0 - 23) # │ │ ┌───────────── day of month (1 - 31) # │ │ │ ┌───────────── month (1 - 12) # │ │ │ │ ┌───────────── day of week (0 - 6) (Sunday to Saturday; # │ │ │ │ │ 7 is also Sunday on some systems) # │ │ │ │ │ # │ │ │ │ │ # * * * * * command to execute
so as per your requirement you set the cron job for your script.
eg
in above image you can see 2 cron jobs, 1st one runs at 16:52 and the second one runs at every 30 mins.
once modify save the file & you are done with your cron job setup.
Let me know if you have any doubts
Yours
Tarz - tarz@techie.com
No comments:
Post a Comment