RE: [PHP] Date format from file

From: Date: Wed, 05 Feb 2003 18:39:06 +0000
Subject: RE: [PHP] Date format from file
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-134460@lists.php.net to get a copy of this message
> I'm not using this for any database related function. What I'm trying to > do is come up with a method for scheduling processes needed for our > company that are run through command line php scripts. I'll be using cron > or to run a command that will check the date within the file and see if > the process needs to be run on that day and then rewrite the date + 28 > days back into the file spawning the process if need be. To the best of my > knowledge cron cannot run schedules this way. It can only run on specific > days or times outlined directly. Our processes must run every 28 days, not > a specific day of the month. If there is any other scheduling system out > there that can do this type of thing on Linux/Unix I'd much rather use it > than doing it this way. Sorry, I though I read database in there somewhere. I don't know of another program. As long as you write a unix timestamp or some date format that can be parsed by strtotime(), then you can do it this way. Use fopen()/fread() to get the last time saved in the file. If you're using unix timestamps, just see if the current time is greater than the old timestamp + 28 days... If(time() < $old_timestamp + 60*60*24*28) { //run script and save new time(); } ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/

« previous php.general (#134460) next »