besly98 Posted August 5, 2009 Share Posted August 5, 2009 Hi All, I wanted to run a script at midnight every day (00:00:00 hrs my server time). Can i simply do an if statment based on the server time, to say if the time is midnight.. do this.... (and will it run witout the page being loaded up.. just go in the background?) thanks for your help Link to comment https://forums.phpfreaks.com/topic/168909-php-servertime/ Share on other sites More sharing options...
tobimichigan Posted August 5, 2009 Share Posted August 5, 2009 Have u tried echoing the session page? Link to comment https://forums.phpfreaks.com/topic/168909-php-servertime/#findComment-891163 Share on other sites More sharing options...
besly98 Posted August 5, 2009 Author Share Posted August 5, 2009 what do you mean? i have not set anythign up, as im not 100% sure what to do. as i said, if i can simple use a if statment to say if the time is midnight run this script..... but i need it to run in the background. Link to comment https://forums.phpfreaks.com/topic/168909-php-servertime/#findComment-891179 Share on other sites More sharing options...
Zepo. Posted August 5, 2009 Share Posted August 5, 2009 In short, yes you can do that. A simple if/them statement would work. I'm not sure about this one but i think you might be able to setup a cron if you use cpanel to do the same thing as the if/then statement. Link to comment https://forums.phpfreaks.com/topic/168909-php-servertime/#findComment-891186 Share on other sites More sharing options...
besly98 Posted August 5, 2009 Author Share Posted August 5, 2009 cool. thanks. and this will run in the background, and i wont need to touch anything?> Link to comment https://forums.phpfreaks.com/topic/168909-php-servertime/#findComment-891188 Share on other sites More sharing options...
Zepo. Posted August 5, 2009 Share Posted August 5, 2009 Yup. Why not try it Link to comment https://forums.phpfreaks.com/topic/168909-php-servertime/#findComment-891192 Share on other sites More sharing options...
besly98 Posted August 5, 2009 Author Share Posted August 5, 2009 thanks and this is the server time isnt it? <? echo time(); ?> Link to comment https://forums.phpfreaks.com/topic/168909-php-servertime/#findComment-891200 Share on other sites More sharing options...
Zepo. Posted August 5, 2009 Share Posted August 5, 2009 Yes. Or you can use $_SERVER['REQUEST_TIME']. The only problem with this that i just thought of is someone would have to load that page right on that millisecond to run that statement, i think the cron job would be a better alternative. Read: http://www.modwest.com/help/kb5-125.html Link to comment https://forums.phpfreaks.com/topic/168909-php-servertime/#findComment-891201 Share on other sites More sharing options...
besly98 Posted August 5, 2009 Author Share Posted August 5, 2009 oh. i thought it would run in the background? without the page being loaded? Link to comment https://forums.phpfreaks.com/topic/168909-php-servertime/#findComment-891207 Share on other sites More sharing options...
Zepo. Posted August 5, 2009 Share Posted August 5, 2009 Sorry, i misread it. You would need to call the page at the right time. Check the link above. Link to comment https://forums.phpfreaks.com/topic/168909-php-servertime/#findComment-891208 Share on other sites More sharing options...
besly98 Posted August 5, 2009 Author Share Posted August 5, 2009 it looks confusing lol Link to comment https://forums.phpfreaks.com/topic/168909-php-servertime/#findComment-891220 Share on other sites More sharing options...
trq Posted August 5, 2009 Share Posted August 5, 2009 Scripts don't run themselves, you need to use your server operating systems scheduler. Linux has cron, windows has task scheduler. Link to comment https://forums.phpfreaks.com/topic/168909-php-servertime/#findComment-891222 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.