
September 8th, 2004
08:28 AM
Automated PHP script execution?
I am currently designing a text based game just for fun. Every night at midnight I want all characters "energy" reset back to 10/10. So if they used it up the day before it will be back. I can easily write a PHP script to do that to the mySQL database, but the question is how do I execute a script like that every night at 12:00. My test server runs linux, is there a way to do it on linux?
Thanks for your help in advance.
Marf
___________________


September 8th, 2004
08:29 AM
Neversidian
Status: Offline!
Run a cron job.
http://www.adminschoice.com/docs/crontab.htm
___________________
"Hey, **** YOU!"

September 8th, 2004
09:02 AM
So what's up :)
Status: Offline!
Or just check time every time they play, if it's past midnight refill energy and if it's not then leave it the way it is. They can't see their energy if they don't run the script 
___________________
"¿Por qué buscais la felicidad, oh, mortales, fuera de vosotros mismos?"
~Boecio

September 8th, 2004
09:13 AM
somehow, cronjobs dont like me...I can never do them right =/
___________________
xXxXxXx

September 8th, 2004
04:17 PM
whoa, wtf?
Status: Offline!
Originally posted by Alekz
Or just check time every time they play, if it's past midnight refill energy and if it's not then leave it the way it is. They can't see their energy if they don't run the script
Inefficient on a popular site.
___________________
Fomerly known as lasnaranjas. Holler.


September 8th, 2004
09:57 PM
ok then
0 0 * * * /path/to/php/cgi /path/to/php/file.php
would be the cron script
But now I think I might want the script to execute once every 30 minutes. How would I do that instead?
___________________


September 9th, 2004
04:16 AM
That would just make it do it at 12:30 midnight every night.
___________________
