crons jobs in linux shell

cron is used to schedule the jobs in Linux. It allows you do below things.
  • Add the job in crontab for specific user
  • Remove the job in crontab
  • View history of cron jobs

Adding new cron job

You can add cron job using below command.
 
crontab -e

Then you need to add the jobs using below syntax.
 
minute hour dayOfMonth month dayOfWeek <command>
For example – below command will schedule a cron job to run after every 20 minutes.
 
*/20 * * * * /home/myjob.sh

View cron jobs

Below command will list all cron jobs of current user.
 
$ crontab -l

Below command will list all cron jobs of given user.
 
$ crontab -u <user-name> -l

Removing cron jobs

Below command will remove all cron jobs of current user.
 
$ crontab -r

Web development and Automation testing

solutions delivered!!