RSS

Enable Crontab Job in ubuntu/Centos

31 Dec

Step1:

List crontab jobs

crontab -l

Step2:

Open and edit crontab

crontab -e

Step3:

copy and past the following comment and replace the exact path.

Example to run every 1 min:

*/1 * * * * /home/user/fileToStart.sh >> /home/user/logfile.log 2>&1

Example to run on 4:01am on January:

01 04 * * * /home/user/fileToStart.sh >> /home/user/logfile.log 2>&1

Layout example:

minute (0-59), hour (0-23, 0 = midnight), day (1-31), month (1-12), weekday (0-6, 0 = Sunday)

01 04 1 1 1 /home/user/fileToStart.sh >> /home/user/logfile.log 2>&1

 

 
Leave a comment

Posted by on December 31, 2015 in CentOS, shellscript, Ubuntu

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: