Re: shedule a php script
| From: | Ben Ramsey | Date: | Sat, 05 Jun 2004 16:07:33 +0000 |
| Subject: | Re: shedule a php script | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-187685@lists.php.net to get a copy of this message | ||
If you're on a Unix-like system, add the following at the top of your script:
#!/usr/local/bin/php
Of course, modify the path to the location of your php binary, since it may not be in the same location. Then, make the file executable with:
chmod +x filename.php
Then, create a cron job to run the script however often you want.
Curlybraces Technologies Ltd wrote:
hi friends , when running this php script we can make a log file with relavent to the mysql data base. but i need to execute this script after every 2 min time. that is mean there must be a 2 min sleep time . can somebody help me do this function plz .........? <?php require ('connectMySql.php'); $select= " select ServiceNo, ServiceName, Status, DateTime from ServiceStatus "; $add_member = $db_object->query($select); $result=mysql_query($select);-- Regards, Ben Ramsey http://benramsey.com --------------------------------------------------- http://www.phpcommunity.org/ Open Source, Open Community Visit for more information or to join the movement. ---------------------------------------------------while($row=mysql_fetch_array ($result)) { $output1 =$row['ServiceNo'];$output2 =$row['ServiceName']; $output3 =$row['Status']; $output4 =$row['DateTime']; $your_data .= " $output1.\t $output2 -> $output3 -> $output4 \n"; $output = "$your_data \n"; } // Open the file and erase the contents if any $fp = fopen("vas_status.log", "a"); // Write the data to the file fwrite($fp, $output); // Close the file fclose($fp);if (DB::isError($add_member)) { die($add_member->getMessage()); } $db_object->disconnect(); ?> thanx in advance curlys