cron job
Moderator: General Moderators
-
tylerdurden
- Forum Commoner
- Posts: 66
- Joined: Mon Jul 28, 2003 11:52 am
- Location: Austria
2 ways:
If you have the CLI version of PHP installed you can simply call the script with
If you don't have CLI PHP you could install a cronjob that uses wget or curl to call the script on the webserver.
If you have the CLI version of PHP installed you can simply call the script with
Code: Select all
php scriptname.phpJust some FYI. You can run a cron job with either a CLI or CGI install. I've been running php based jobs for two years now on machines with CGI installations . At the top of the script, you will need a line like the one below telling the system where the php executable is.
#!/usr/local/bin/php -q
#!/usr/local/bin/php (If you have a CLI install)
You will also need to understand the crontab commands. Just do a man crontab from the command line to get information on how to do it.
There are also a number of tutorials on creating cron files that can be found on google.
Lastly, I'm assuming you are on a Linux/Unix type system. If you are on Windows, there are options, but you have to find them on google. I've explored them, but it's been a while and I don't remember where they are.
Cheers,
BDKR
#!/usr/local/bin/php -q
#!/usr/local/bin/php (If you have a CLI install)
You will also need to understand the crontab commands. Just do a man crontab from the command line to get information on how to do it.
There are also a number of tutorials on creating cron files that can be found on google.
Lastly, I'm assuming you are on a Linux/Unix type system. If you are on Windows, there are options, but you have to find them on google. I've explored them, but it's been a while and I don't remember where they are.
Cheers,
BDKR
i put all the PHP file inside this directory
http://10.1.1.200/B0300549/public_html/phpweb/cron.php
the cron.php is the page that i need to run
if i want to run the cron.php once a year (every January), is it the correct way that i wrote?
crontab -e
* * * 1 * php /10.1.1.200/B0300549/public_html/phpweb/cron.php
then, am i need to put this line on top of the cron.php
#!/10.1.1.200/B0300549/public_html/phpweb/php
http://10.1.1.200/B0300549/public_html/phpweb/cron.php
the cron.php is the page that i need to run
if i want to run the cron.php once a year (every January), is it the correct way that i wrote?
crontab -e
* * * 1 * php /10.1.1.200/B0300549/public_html/phpweb/cron.php
then, am i need to put this line on top of the cron.php
#!/10.1.1.200/B0300549/public_html/phpweb/php