Forum Moderators: coopster

Message Too Old, No Replies

Cron Job with Virtual Hosting?

         

Emperor

11:01 pm on Jun 4, 2005 (gmt 0)

10+ Year Member



Hi guys,

I made a PHP script that creates an HTML file. I want that script to execute every hour.

I have a virtual hosting account so I don't know how much I can do, i.e. setting up a proper cron job.

Any ideas?

Also, if people are constantly hitting the HTML page that my PHP script creates will PHP overwrite the file properly so it gets used when it's written to disk?

Thanks.

badone

11:45 pm on Jun 4, 2005 (gmt 0)

10+ Year Member



Do you have command line access?

If so, type "crontab -e". If you get no errors enter your cron job, and make sure it's saved.

Rather than writing to the active file I think it's probably a better idea if you write to a temporary file, delete the orignal, then move the temp file into place. Less chance of users getting half a page IMHO.

Cheers,
BAD

Emperor

12:16 am on Jun 5, 2005 (gmt 0)

10+ Year Member



No, I don't have command line access.

Anything else I can do?

Thanks.

badone

6:03 am on Jun 5, 2005 (gmt 0)

10+ Year Member



Only thing I can think of is create the file somewhere else and automatically upload it (ftp?) every day, but that's starting to get a bit error-prone/messy.

Alternative, what about a page that creates the new content when you access it and a cron job ("at" under windows) that triggers the script every day. Yeah, that'd be better I think.

HTH,
BAD