Run a shell script everyday automatically at a specified time

What is Cron?

Cron is a scheduling utility that allows you to assign tasks to run at preconfigured times. Cron is started at boot and runs in the background as a daemon. This means that it runs without user interaction and waits for certain events to happen to decide when to execute.

Cron decides which commands to run at what time by reading a series of files, each known as a “crontab”. We can see the system-wide crontab by looking at “/etc/crontab” file


If you want to run your script “/home/anukul.verma/” everyday @ 03:30 PM

Add this line in /etc/crontab file :

30   15   *   *   *   root /home/anukul.verma/

30 => minute (0 – 59)
15 =>  hour (0 – 23)
*  =>  day of month (1 – 31)
*  =>  month (1 – 12) OR jan,feb,mar,apr …
*  =>  day of week (0 – 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
root  =>  user-name

/home/anukul.verma/ =>  command to be executed

Note : Reboot the system to get changes effective

PS: Check permission of executable command/file



Leave a Reply

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

You are commenting using your 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