elpaulet Posted February 5, 2007 Share Posted February 5, 2007 Hello. Let's say that i have a mysql table with 100,000 lines/products and more columns, two of them are expire_date and expire_time. I want that different php scripts to be run based on this two values. For example, i want an automatic notification email to be sent with 3 days before the expiration date to the owner of the product, i want an automatic email to be sent in the minute the products expires, i want that a product to be deleted 3 days after the expire_date etc. I can do the scripts, this is not a problem. The problem is that i need a macanism that can detect when the date and time has come for a script to be run. How can i do this? Thank you. Link to comment https://forums.phpfreaks.com/topic/37112-automatic-php-script/ Share on other sites More sharing options...
btherl Posted February 5, 2007 Share Posted February 5, 2007 The standard way to do this is to have a script run regularly (every day, every hour, every 5 minutes, for example). And usually this will be done using cron, on a unix server. That script will check if it has any work to do each time its run. Link to comment https://forums.phpfreaks.com/topic/37112-automatic-php-script/#findComment-177251 Share on other sites More sharing options...
elpaulet Posted February 5, 2007 Author Share Posted February 5, 2007 ok. i got it. let's say i have a page called notification.php wich contains the script that checks the database and sends email based on some criteria. let's say that my provider has cron on the server. what next? how can i make my notification.php to be run hourly par example? Link to comment https://forums.phpfreaks.com/topic/37112-automatic-php-script/#findComment-177254 Share on other sites More sharing options...
btherl Posted February 5, 2007 Share Posted February 5, 2007 Hmm.. I think that would be with a crontab entry like this: 0 * * * * /path/to/notification.php That means "Run the script at minute 0, every hour, every day, every month, every day of the week". Which basically means run at minute 0 every hour. I'm not sure how your server handles adding cron jobs though. Maybe they have an interface for doing it. The above is the format you would use if you wanted to edit your crontab (the file listing cron jobs) from a shell, using crontab -e (hmm.. my memory is a bit vague on whether that's the right command or not) Link to comment https://forums.phpfreaks.com/topic/37112-automatic-php-script/#findComment-177256 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.