php - To use sleep() or cron job -


I have this mail script which I have to run a few times, to start the script I will use the cron, but the script Run 2 or 3 times (separated with one hour).

What is the best way to do this? To use the sleep command at the end of the script, or for an hour, put some code, so that the script creates a new cron job to run automatically after one hour?

Thanks

Unless the script runs in memory, there is no cost savings By that time, you can do better by adding it to the cron. Hours, as required

  0 0-2 * * * /usr/local/bin/mail-script.php  

You - Syntax You can select several hours by using, or comma syntax:

  0,2,3,3 * * * /usr/local/bin/mail-script.php  < / Pre> 

If it needs to maintain some type of state, use a temporary file to keep a saved state.

Do:

  & gt; Man 5 Crontab  

To see if your * nicks handles the above cases.

Finally, as long as you do not know the script only 2-3 times, you're doing better that it argues that PHP script "to run Or not to run "what is, and then just run it every hour.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -