Jul 31, 2001, 11:00 PM
Post #1 of 1
I have written a script that is half complete to this point. I am attaching the current copy of the working script. You can take the time to look over it now so I can save explaining of the script here.
Case for cron?
This script will display the server's current time. It then will allow a user to set the time that they want an action to occur.
The server's current time and the user's set time will have to be checked to see how they compare.
I am trying to write this so that every 5 minutes (just an estimated time), the script will then run and compare the server's new time and the time that the user set. I would like to set those two variables like
if $currenttime is greater than or equal to $newsettime then it should print a Web page with the message for the user. And if $currenttime is less than $newsettime, then it should wait and run again after the specified time has passed again.
A user had suggested cron and that does sound logical. I was originally thinking of writing a subroutine that would 'refresh' the page that does the comparison every 5 minutes (estimation again)...but I think cron would work out better.
I could set cron to run the script every minute or 5 minutes and that should solve the problem of getting the program to constantly check the values of the two scalars to either bring up the new page or just wait and check again. This sounds possible right?
I want to offer this script to anyone who would like to run it, but then this would make the script cron dependent and anyone who does not have access to cron would not be able to run the script. Can anyone think of a way to write the 'refresh' or another method to get the script to essentially compate the two variables? This would make it 'easier' for the average user to install it on their site and run it from their server.
If cron is the best method and I can get it to work properly, then I will most likely keep the program specific to my site, but I would prefer to offer it to those who may have a need for it.
Please take a look at my script and tell me what you think about this 'problem'. Ask any questions that you may have. Thank you for your time
$a = new pointless CGI();