Cron Job

A very interesting service that the linux provide to run our command at regular interval.
it is very easy to use.
Note:- “/usr/bin:/bin” this is the default path use by crontab. any command outside this directory will not be run. for that you have to provide the direct link of your command to run

basic syntax
* * * * *  <command>

you can see the 5 star above which represent the schedule to run you command.

the first * represent minute (0-59)

sec * represent hour(0-23)

third * represent day of month(1-31)

forth * represent month(1-12)

fifth * represent day of the week(0-6)

<—————>

For simple demo
to open your crontab type

env EDITOR=nano crontab -e 

this open your crontab in nano editor. here you can have number of cron job. all the command must be in separate line.

Example 1

6 * * * *  /Applications/XAMPP/xamppfiles/bin/php  ~/Desktop/phpFile/example.php

this will run the example.php file located at Desktop/phpFile folder in every 06 minute of any hour.i.e 1:06,2:06

Leave a comment