Cron Job Question


#1

I want to run a cron job from my domain at Dreamhost to execute a cgi file to delete my logs on another host. The other host does not offer cron jobs. What I originally entered in the control panel was simply:

http://www.mydomain.com/dellogs.cgi

which doesn’t work.

Should I be using

wget http://www.mydomain.com/dellogs.cgi ?

I have other cron jobs setup so I am familiar with how they work and I know the script works. I tried searching for this scenario at Google and have not found the answer.

Thanks for any help.


#2

I think I would be inclined to just try it and see if works. Especially if as you say the script works.

i.e. entering http://www.mydomain.com/dellogs.cgi in your browser does what you want it to.

So you could always try :-

Setting the crontab as required of course.

It will either work or it will not work.
Just like my toaster!


Norm

Opinions are my own views, not DreamHosts’.
I am NOT a DreamHost employee OK! :@

Act on my advice at your own risk!


#3

Thanks Norm. I’ll give it a shot.

/usr/bin/wget -q -O /dev/null

That’s the part that probably would have taken me forever to find.


#4

Ok… that didn’t seem to work. I set it up in the control panel to execute every hour on the hour, just so I wouldn’t have to wait a day to check it. I ran the script through the browser previously so I know that’s not the problem.

I’ll set up the “email output” option to check for errors.


#5

If your other domain gives you access to the webserver logs then you may see something under the error.log.

It could be that the other domain/web host is set up to not allow wget to access cgi from outside the domain.

Are you familiar with using SSH to access your DreamHost shell? You could try running the wget program from the command line and you should see any errors.

Also try using lynx in place of wget and see how that fairs.

/usr/bin/lynx http://www.mydomain.com/dellogs.cgi > /home/username/example.com/errors.txt 2>&1 Which should send any errors to/result to errors.txt where you can view it.

Likewise under cron you could try wget again to see the output.

* * * * * /usr/bin/wget http://www.mydomain.com/dellogs.cgi > /home/username/example.com/errors.txt 2>&1 Then when it is working you can replace error.txt with /dev/null


Norm

Opinions are my own views, not DreamHosts’.
I am NOT a DreamHost employee OK! :@

Act on my advice at your own risk!


#6

I dumped the output to errors.txt and there was nothing in it that would indicate a problem. Showed that it accessed the file fine with a response of 200. So at least that part works. Also checked the access log on the other host. Same thing, response of 200. Checked the error log there as well. Nothing to indicate any problem. Still not deleting the logs.

I used to use a free cron service to access this file and delete the logs and it worked. I suppose I could go back to that, but thought it would be easier to do it from here.

Maybe wget is not the right command to use???


#7

There is nothing you normally have to do other than just use that URL?
Maybe you just chose the wrong day when the program decided to play up :slight_smile: .

Did you try lynx yet?


Norm

Opinions are my own views, not DreamHosts’.
I am NOT a DreamHost employee OK! :@

Act on my advice at your own risk!


#8

“Maybe you just chose the wrong day when the program decided to play up”

I think you may be right. Now the d*mn url doesn’t even work even though it worked a few hours ago! And, I haven’t touched anything to do with it. Bizarre!

I will put this aside for awhile and tackle it again when I’m not so tired.

Thanks for all your help.