Re: [PHP] PHP 24 hour processes?
Nathan Rixham wrote: Daniel Brown wrote: On Mon, Feb 25, 2008 at 1:39 AM, Zoran Bogdanov <[EMAIL PROTECTED]> wrote: Hi, How can you perform a timed event in PHP; for example: Count 24 hours and then delete all rows in a database... Once again, I say verily unto you: RTFM and STFW. Linux/*nix: cron Windows: at Cron Example: 40 03 * * * `which php` /path/to/php/script.php PHP: of negate php all together and use cron to schedule: mysql -h hostname -u username -ppassword -e "TRUNCATE TABLE `table_name`" clean forgot, if your on mysql 5.1.6> then you can use the "create event" syntax http://dev.mysql.com/tech-resources/articles/event-feature.html no need for cron or php and platform independant :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 24 hour processes?
Daniel Brown wrote: On Mon, Feb 25, 2008 at 1:39 AM, Zoran Bogdanov <[EMAIL PROTECTED]> wrote: Hi, How can you perform a timed event in PHP; for example: Count 24 hours and then delete all rows in a database... Once again, I say verily unto you: RTFM and STFW. Linux/*nix: cron Windows: at Cron Example: 40 03 * * * `which php` /path/to/php/script.php PHP: of negate php all together and use cron to schedule: mysql -h hostname -u username -ppassword -e "TRUNCATE TABLE `table_name`" -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 24 hour processes?
On Mon, Feb 25, 2008 at 1:39 AM, Zoran Bogdanov <[EMAIL PROTECTED]> wrote: > Hi, > > How can you perform a timed event in PHP; for example: > > Count 24 hours and then delete all rows in a database... Once again, I say verily unto you: RTFM and STFW. Linux/*nix: cron Windows: at Cron Example: 40 03 * * * `which php` /path/to/php/script.php PHP: -- Daniel P. Brown Senior Unix Geek -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 24 hour processes?
Bojan Tesanovic wrote: Windows also have something similar to cron Schedule accessory can also be set to execute some php every xxx minutes/days etc For linux it is much easier , create file eg cron.txt that has this content #=== * 1 * * * /home/user/cleanUpDB.php #=== save it and than enter in console crontab cron.txt this will install cron job that will execute /home/user/cleanUpDB.php script every day at 1AM . One note on executing PHP scripts by cron ,you may want to include path of PHP binary as it may not be in PATH so * 1 * * * /library/php5/bin/php /home/user/cleanUpDB.php where /library/php5/bin/php is absolute path to yours PHP binary file On Feb 25, 2008, at 7:46 AM, Paul Scott wrote: On Mon, 2008-02-25 at 07:39 +0100, Zoran Bogdanov wrote: How can you perform a timed event in PHP; for example: Count 24 hours and then delete all rows in a database... I thought that this question was answered in some detail before... Anyway, on *NIX based systems use cron.daily or on 'doze, use AT or command scheduler I think it's called. Either that or use a long running PHP process with ignore_user_abort() and a time of 86400 seconds :) --Paul All Email originating from UWC is covered by disclaimer http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Kosovo je Srbija. Bojan Tesanovic http://www.classicio.com/ http://www.carster.us/ Be sure that if you install and run this script as root, that you set it so your script is only writable by root. You don't want someone inserting malicious code into your script and then just blindly running that code. :) -- Jim Lucas "Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them." Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 24 hour processes?
create file eg cron.txt Or if your version of crontab supports it (not all do) then you can use: crontab -e And to get the manual page, you can do this: man 5 crontab -- Richard Heyes http://www.phpguru.org Free PHP and Javascript code -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 24 hour processes?
Windows also have something similar to cron Schedule accessory can also be set to execute some php every xxx minutes/days etc For linux it is much easier , create file eg cron.txt that has this content #=== * 1 * * * /home/user/cleanUpDB.php #=== save it and than enter in console crontab cron.txt this will install cron job that will execute /home/user/ cleanUpDB.phpscript every day at 1AM . One note on executing PHP scripts by cron ,you may want to include path of PHP binary as it may not be in PATH so * 1 * * * /library/php5/bin/php /home/user/cleanUpDB.php where /library/php5/bin/php is absolute path to yours PHP binary file On Feb 25, 2008, at 7:46 AM, Paul Scott wrote: On Mon, 2008-02-25 at 07:39 +0100, Zoran Bogdanov wrote: How can you perform a timed event in PHP; for example: Count 24 hours and then delete all rows in a database... I thought that this question was answered in some detail before... Anyway, on *NIX based systems use cron.daily or on 'doze, use AT or command scheduler I think it's called. Either that or use a long running PHP process with ignore_user_abort() and a time of 86400 seconds :) --Paul All Email originating from UWC is covered by disclaimer http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Kosovo je Srbija. Bojan Tesanovic http://www.classicio.com/ http://www.carster.us/
Re: [PHP] PHP 24 hour processes?
On Mon, 2008-02-25 at 07:39 +0100, Zoran Bogdanov wrote: > How can you perform a timed event in PHP; for example: > > Count 24 hours and then delete all rows in a database... > I thought that this question was answered in some detail before... Anyway, on *NIX based systems use cron.daily or on 'doze, use AT or command scheduler I think it's called. Either that or use a long running PHP process with ignore_user_abort() and a time of 86400 seconds :) --Paul All Email originating from UWC is covered by disclaimer http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP 24 hour processes?
Hi, How can you perform a timed event in PHP; for example: Count 24 hours and then delete all rows in a database... Thank you! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php