Cron job is time based job schedule which runs periodically at fixed set of time in linux and unix-like computer systems. With the help of Cron tab, you can run commans periodically and do task in your server.
In this article, we will show you how to views cron jobs and create new cron job.
To view cron jobs file, run below command:
sudo crontab -e
This will open cron job file:
If you only want to see cron jons without openning file, run command:
To see cron job for specific user, run command:
crontab -u username -e
To set new cron job, add the line at the end of file
* * * * * command --arguments output
The first 5 fields are for specific time of the job. You can see and set the time for cronjob at CronGuru.
The sixth field is the command which you want to execute given time period.
The last output field is optional. If you want to output cron results, then you can specify.
Here are the few examples of cron jobs:
|Run every 1 minute||* * * * * /root/backup.sh|
|Run every hour||0 * * * * wget https://website.com/|
|Run every 12 hour||0 */12 * * * curl -s http://website.com/backup.php|
|Run every month 1st date||0 0 1 * * command|
If you want graphical UI to learn and set time for cronjob, you can see Crontab generator
In this article, we have discussed how to view and create new Cron job. I hope you liked this article.
How to install tar.gz or tar.bz2 file in UbuntuIn modern Linux distribution, almost sof...
Angular 12 Line Chart using ng2-charts ExampleThis example is fixated on the angular 1...
How to create Sitemap FormatSitemap is a blueprint of your website t...
Authenticate Users With Node ExpressJS and Passport.jsToday, Node Js one of the most popular l...
How to create a query string from an array in PHPWhen sending get request to third party...