Lunarpages Web Hosting Forum

Author Topic: Script each nightt...what's best solution?  (Read 2058 times)

Offline MusicMaven

  • Trekkie
  • **
  • Posts: 14
    • http://www.musicmaven.lunarpages.com
Script each nightt...what's best solution?
« on: October 07, 2002, 07:11:00 AM »
Each night I have a series of 6 .php files that I run. These files total well over 1000 lines and do a variety of SQL statements, updating, deleting, adding records to my MYSQL database, as well as looping, if statements...all that crap.

Obviously, I would like to automate this, but the best solution I know of is to make a CRON job that references the .php files. But I don't consider this to be a good solution since I don't want those 6 php files to reside on my webserver all the time. (People might by some weird chance type in the url that executes one of those 6 php files.)

So what is the best way to handle this? Is this what CGI is for? I am open to any solution & am willing to try anything...but I'm looking for the "most professional" solution.

Any help?

Thanks for your time.
-doug

stephan

  • Guest
Script each nightt...what's best solution?
« Reply #1 on: October 07, 2002, 07:15:00 AM »
Can't you just use the CRON job like you said, but just put them in your root directory, where noone can get them.

i.e. one directory back from public_html

I think that would be a good solution.

Offline MusicMaven

  • Trekkie
  • **
  • Posts: 14
    • http://www.musicmaven.lunarpages.com
Script each nightt...what's best solution?
« Reply #2 on: October 07, 2002, 07:21:00 AM »
Good point, but (and here's where I really show my inexperience), I noticed that the CRON only allows 1 entry, but I had 6 php files to run. And the 4th file takes about 2 minutes to complete. Should I create a 7th php file that simply has 6 include lines, and trust that the 6 files will then execute, and will execute in order, and will not time out?

thanks for the help!

stephan

  • Guest
Script each nightt...what's best solution?
« Reply #3 on: October 07, 2002, 01:04:00 PM »
Yes, although there probably is a way to have more than one entry.

There must be.

stephan

  • Guest
Script each nightt...what's best solution?
« Reply #4 on: October 07, 2002, 08:27:00 PM »
Or, another way to do it is just to set different times for each script.

They can be run one after another, they don't need to all be run at the same time.

Just set one for 2am,
one for 2:30
one for 3
one for 3:30 etc.

It will reduce the load on the server aswell.

Offline jnellis

  • Pong! (the videogame) Master
  • *****
  • Posts: 23
    • http://www.mtcrossroads.org
Script each nightt...what's best solution?
« Reply #5 on: October 16, 2002, 01:13:00 PM »
Put the scripts in a seperate directory under your cgi-bin. You can make more than one CRON job entry or do the 7th file include trick.  Then web protect this seperate directory you have these php files in.  No one will accidently run these scripts this way with a username/password box coming up everytime.  This also allows you to run the scripts anytime you wish from any webbrowser besides just waiting for the cron job at night.

Offline MusicMaven

  • Trekkie
  • **
  • Posts: 14
    • http://www.musicmaven.lunarpages.com
Script each nightt...what's best solution?
« Reply #6 on: October 17, 2002, 09:27:00 AM »
When I add a file to a subfolder under my cgi-bin, and then try to access that php file, I get the following error:
"
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
"

stephan

  • Guest
Script each nightt...what's best solution?
« Reply #7 on: October 17, 2002, 11:13:00 AM »
You can look in your statistics page, under Error messages, to find out what that means.