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:
crontab -l
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:
Description | Command |
---|---|
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.
Hi, My name is Harsukh Makwana. i have been work with many programming language like php, python, javascript, node, react, anguler, etc.. since last 5 year. if you have any issue or want me hire then contact me on [email protected]
How to install tar.gz or tar.bz2 file in Ubuntu
In modern Linux distribution, almost sof...Angular 12 Line Chart using ng2-charts Example
This example is fixated on the angular 1...How to create Sitemap Format
Sitemap is a blueprint of your website t...Authenticate Users With Node ExpressJS and Passport.js
Today, Node Js one of the most popular l...How to create a query string from an array in PHP
When sending get request to third party...