Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

run the code automatically once a week?

Status
Not open for further replies.

hisham

IS-IT--Management
Nov 6, 2000
194
I have a php code can create a text file and save it in a folder, How can I make this code run automatically for example once a week?
 
PHP Version 4.2.3 Runnung on Linux, and i have only a web-server module, and i can't set up crontab
 
That seriously limits your options if you can't setup a crontab. I'd say the short answer is no, you can't setup the code to run once a week.

The long answer is, at least not serverside. You could setup another box with a crontab or AT (windows) command, which launches a browser that visits a page that executes your code once a week... then just add in some javascript in your code that closes the window when the code is complete (or you could probably make cron or windows just close the browser after x minutes too)

-Rob
(maybe I'm wrong... but that's my understanding)
 
Depending on why you need to create a txt file once a week, You could store a date in a txt file (or database if available), then at the start of your script compare todays date with the date stored. If today is later than todays date, then create the file.
Providing enough people visit the site regularly then the txt file would be created about once a week.

Im not sure whether that makes sense to everyone else but it makes sense in my head!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top