|
Comments for: akent20000926
| Message # 1010742: |
|
Date: 04/11/02 00:52
By: Kerry Slavin Profile Subject: RE: scheduling - the easy way I don't think the answers so far provided answer the original question. I get the impression that the web server in question is probably at a hosting company and therefore no shell commands could be used to schedule scripts. Here is an idea for a way of scheduling a script to run on a particular day. While it is not possible to make it happen at a particular time, unless triggering it manually, if your website is getting regular hits, it will run on the right day. Now what you could do, is have a PHP function attached to your home page that gets either the server or the client date and if the day is a particular number (eg. "$day==01") then your scheduled function runs. Now I think that you will only want to run them once so pseudo code is like this; #only way to safely maintain state $runflag = read from file or database #get the day from server or client $day = (date("d")); if ($runflag == 0 && $day == 01) { $runflag=1; write $runflag to file or database run your functions } elseif ($day != 01) { $runflag=0 write $runflag to file or database } Now on the first of the month the first person to request your homepage will trigger the functions to fun. $runflag is set, so that any subsequent requests on day '01' do not trigger a re-run of the functions. From day '02' through day '31', 0 is written to a file. So any load of the webpage throughout the month will reset the flag so that the functions can run again on the first of the month. I haven't tested this but I can't see any reason why it would not work. It lets you schedule scripts without the security issues of SSH. |
Previous Message | Next Message |
| Comments: | ||
| RE: PHP is slower than HTML | Malph | 03/27/04 01:42 |
| no bcsub? | zariok | 01/08/03 16:54 |
| about php | dimas yurisdiansyah | 08/07/02 02:41 |
| RE: scheduling a php script on a web server | gordon | 07/11/02 03:52 |
| this might be easier | Jason E. Sweat | 06/17/02 17:17 |
| CPU execution time | Marcel Schiffer | 06/10/02 05:08 |
| Timer | Mojgan | 05/27/02 06:19 |
| RE: scheduling - the easy way | Nkm | 05/15/02 22:54 |
| RE: scheduling - the easy way | Kerry Slavin | 04/11/02 00:52 |
| RE: scheduling - the easy way | Glen Hassell | 04/10/02 07:51 |
| RE: scheduling a php script on a web server | Nkm | 04/05/02 20:08 |
| scheduling a php script on a web server | Alain | 04/05/02 11:14 |
| RE: PHP is slower than HTML | Will V. | 03/26/02 22:21 |
| RE: PHP is slower than HTML | Berge Schwebs Bjørlo | 01/26/02 08:48 |
| RE: help:Fatal error: Call to undefined function: | em1x | 01/18/02 03:31 |
| PHP is slower than HTML | Peter | 11/28/01 00:08 |
| total time vs. time used to process script | bart ogryczak | 11/16/01 11:08 |
| RE: Why don't you simply add the two numbers?? | Benoit | 10/04/01 10:25 |
| help:Fatal error: Call to undefined function: | sprming | 05/09/01 18:10 |
| RE: date function | jellings | 11/02/00 15:12 |
| Why don't you simply add the two numbers?? | Mac Wang | 10/25/00 01:23 |
| date function | Prem Kumar | 10/24/00 03:23 |
| more timing functions here : | philip olson | 10/06/00 22:48 |
| Providing article code as seperate text file | gh (they wanted it longer, so here goes) | 10/03/00 23:59 |
| RE: time difference from server to server | gh (they wanted it longer, so here goes) | 10/03/00 23:52 |
| time difference from server to server | jaydj | 10/03/00 05:44 |
| RE: bcsub vs round | Vladimir Shapiro | 10/03/00 04:28 |
| RE: database | Vladimir Shapiro | 10/03/00 04:21 |
| just in time! | Oliwier Ptak | 10/02/00 18:22 |
| bcsub vs round | Douglas E. Warner | 09/30/00 11:21 |
| Warning: short excecution times | Ulf Wendel | 09/27/00 10:48 |
| An example from Cold Fusion | Jeremy Bailey | 09/27/00 08:31 |
| database | Uioreanu Calin | 09/27/00 07:42 |
| database | Uioreanu Calin | 09/27/00 06:44 |
|
If you are looking for help, please post on the appropriate forum here. Your questions will be answered much more quickly. | ||


