How to execute a script each day? Here it is!

From: Date: Mon, 11 Dec 2000 09:35:48 +0000
Subject: How to execute a script each day? Here it is!
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-29648@lists.php.net to get a copy of this message
Emmanuel, If you are using a *NIX system such as Linux as a server you are a lucky guy because you could do a executable script that could be placed outside the web server and run a a program! I have the same need as you. So I have a few .php4 files that I have marked as executables and are scheduled on the crontab to make deletion on tables and gerenal maintanance. What you need to do is this : 1) Create a directory out of the webserver tree. 2) Create a script file like this : -------------------------------------------- #! /usr/local/bin/php echo "This is an example script program" --------------------------------------------- Notice : the first line contains the name and location of the program that is PHP in this case. The PHP parser is located at /usr/local/php directory. 3) save the file as execute.php 4) change the file permissions to make it executable : chmod +x execute.php or chmod 700 execute.php 5) Edit the crontab to execute the file execute.php In this example the script will only output to the screen a frase "This is an example script program" but it could perform any PHP operation such as mess with a MySQL database, send an e-mail with attachments, search for e-mails on a mailbox and have the attachments saved on a directory, etc, etc. Just use your creativity. PHP, Linux and MySQL working together are the killer apps!!! Also, The cool thing about this is that this script can also function as a CGI program by placing it on the CGI subdirectory of a webserver as well. If you are using Windows, though, I'm sorry for that you gotta make the big update for Linux. In our company we used to work with huge NT servers. Now, that we had migrated them all to LINUX as well as rewritten all the apps I can state to you : What a difference!!! I don't have to mess with the servers anymore. Just make sure that have electrial power.... OK let's be impartial.... For windows you can write a Delphi app using ZEOS MySQL components and have it scheduled through the windows scheduler. Or, use Delphi to do it for you. Make your app self schedule. I had done this a year ago not to rely on windows scheduler and also because I had used some windows 95 client machines running Delphi apps to perform scheduled server functions. cheers, Carlos Fernando Scheidecker Antunes. ----- Original Message ----- From: "Emmanuel Halphen" <manu@halphen.net> To: "Joe Stump" <joe@earth.care2.com> Cc: <php-general@lists.php.net> Sent: Sunday, December 10, 2000 10:06 AM Subject: RE: [PHP] How to execute a script each day ? thanks, but is it possible to put the execution of a php script into the cron ? Emmanuel -----Message d'origine----- De : Joe Stump [mailto:joe@earth.care2.com] Envoyé : dimanche 10 décembre 2000 11:30 À : Emmanuel Halphen Cc : php-general@lists.php.net Objet : Re: [PHP] How to execute a script each day ? bash$ man crontab --Joe On Sun, Dec 10, 2000 at 11:27:36AM +0100, Emmanuel Halphen wrote: > Hi, > > > I would like to know if someone know how to execute a php script each day ? > > In fact, I would like to delete each day some data from a database, so I > think executing a php script each night which should do this work. > > Thanks a lot. > > Emmanuel > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net --- Joe Stump PHP Programmer www.Care2.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#29648) next »