Reputation: 617
In my Zend framework Project I want to create a Cron Job. I.e., I want to send a mail to a particular email id ([email protected]) every 1 hrs. I read many docs. As per I have created a folder named Cron in Views->script. I have created a file name cronresult.php also I have created its controller page named cronController. But I don't know any further process.
Where I put my php mail function - script to execute at every 1 hrs. I heard that need to create a crontab, where I create this Crontab file?
Also I have one more doubt... When I logged to my cpanel,there is an option to ceate Cronjobs. SO is it possible to create a cron job from the cpanel?
I don't know any Linux Command.. My project running in CGI
Please help me ..
Upvotes: 0
Views: 786
Reputation: 3000
Once you edit the crontab, either via cpanel or the shell, the script probably expects to be run by the webserver, not at the command line.
So have your cronjob access the webpage like this:
curl --silent --compressed http://my.server.tld/cronresult.php
Upvotes: 0
Reputation: 1803
Each Linux user has his own Cron scheduler to use. You can add jobs with the following command:
crontab -e
In the text file that open you can schedule scripts to run using the following syntax:
0 * * * * php /home/user/example.php
This would run the script /home/user/example.php every hour. In the script you can do whatever processing or mailing you need.
Upvotes: 3