Click to See Complete Forum and Search --> : how to schedule script exectution?
melchior23
03-20-2003, 07:11 PM
i have read about cron in *nix but i am not sure i can use even a win version of this cron function-- the site is on a remote host and i do not think i have the permissions to run scheduled tasks.
The application allows users to make reports two times week . the reporting period is two days long. halfway thru the period (12am ish we want to query for the users that have not reported and send them a reminder via email (this script i can write--have one already) it is just the activation of the script that has me boggled.
any ideas?:confused:
keith73
03-20-2003, 07:19 PM
wihtout cron or some equivalent functionality, you can't do it.
Since it is a win server, remotely hosted, you can't even schedule a task. Talk to your host. If they don't do it tell them you'll be looking for a new host.
- keith
amchargue
03-20-2003, 07:35 PM
I've never tried this, but this has occurred to me before:
If your site gets enough traffic, you could put something in your home page to check the current time (the time of the user's visit) against the time you want your reporting script to run (which you could retrieve/store in a flat file or a db).
Something of the form$time_to_run_script = get_next(); //get value for $time_to_run_script, from flat file or db
if ($now>$time_to_run_script) {
schedule_next(); //set value for $time_to_run_script, in flat file or db
run_script();
}If the current time is after the time you want your script to run, then reset the value in the flat file/db and run the script; else do nothing. But this would only work if you're guaranteed to have traffic, and it probably wouldn't run exactly on the time schedule you want.
If I ever hear that you actually employ this strategy, I will go buy myself a beer to celebrate :D
Mordecai
03-20-2003, 07:46 PM
Check out http://www.wincron.com/ .
statrat
03-23-2003, 06:59 PM
even better, a free cron for windows:
http://www.kalab.com/freeware/cron/cron.htm
i use it from my home box to run a script on my remote host every 3 hours.
daphreeek
03-25-2003, 05:15 AM
Heres an idea - have your computer (or one that is constantly left on - not the server but a pc somewhere) call the web page that does the reports... just set up a cron job (on *nix) or a scheduled task calling the page (windows)
nice and easy :)
- Matt
melchior23
03-25-2003, 02:56 PM
nice idea but i'm not on a *nix machine....guess ya missed this....but statrat has lead me in the right direction for a WIN user... thanks statrat
daphreeek
03-25-2003, 08:57 PM
In my post I gave 2 options - a *nix and a windows option :)
If you use wincron then you need access to the server to install it - I was under the impression it was a remote server that you didnt have access to install things.
- Matt
melchior23
03-26-2003, 01:53 AM
sorry bout that Matt.... overlooked the windows part--my res is 800 x 600----didnt see that b4 i made the post ....
statrat's suggested method involves a windows version of cron --not wincron as you may have supposed-- it's actually cron written for windows (even has a version to run it as an NT service) and wget (an windows app that used to download webpages for offline use) that will execute the script.... this of course is precisely what you suggested
... and so i make a most humble apology :(
.:TCN:.
04-20-2003, 06:06 AM
Maybe run it as an application using the comand line of php?
I've done many similar jobs with this using the CLI of php.
PHP Builder
Copyright WebMediaBrands Inc. All Rights Reserved.