Hi Friends Today iam working on cron job, it is Easy Process.....
If we put the file in cron, It will run automatically by setting the time limit. Using time limit we have run the file every min/hour/day/month etc.
First open terminal (Ctrl+Alt+t)
srinu@srinu-GA-78LMT-S2:~$ sudo su Enter password root@srinu-desktop:/home/srinu# crontab -e
How to select the nano editor
2 /bin/ed
3 /bin/nano
4 /usr/bin/vim.basic
5 /usr/bin/vim.tiny
In cron file we have to set time for run our file, In my case running file evry 5mints so
*/5 * * * * /usr/bin/wget -q http://localhost/cron_test/test.phpAfter that save the file using command (ctl+x), Yes,press Enter.
test.php file will be calling every 5 minutes automatically.
How to edit the cron job
crontab -eHow to list the cron job
crontab -lHow to remove the cron job
crontab -rCrontab syntax:
* * * * * command to be executed ┬ ┬ ┬ ┬ ┬ │ │ │ │ │ │ │ │ │ │ │ │ │ │ └───── day of week (0 - 6) (0 is Sunday, or use names) │ │ │ └────────── month (1 - 12) │ │ └─────────────── day of month (1 - 31) │ └──────────────────── hour (0 - 23) └───────────────────────── min (0 - 59)
No comments:
Post a Comment