WebFaction
Community site: login faq

Hello friends, I have been stuck into very strange situation from past one week. I have to run cron.php of my drupal site periodically. For that I have set a cron job in crontab file using wget. But the wget is not executing inside crontab file. when I run wget seperatally from commandline i.e /usr/bin/wget http://localhost/cron.php it is working but when I write same wget in crontab file as /2 * * * /usr/bin/wget http://localhost/cron.php cron is running but the changes are not happening in the site. the var/log/syslog shows the cron run but the changes are not happening in the site. In drupal's Administer page there is a Reports section inside which there is a subsection recent log entries. The cron run should show in that recent log entries subsection. For wget run directally from commandline the recent log entries is showing the cron run but when wget is run from cron job the cron run is not showing in recent log entries. I also tried to write the wget in an script & then running that script from crontab file by setting cron job but even that is not working. I am tired of seraching this issue on net no real solution is given every where I find the same thing 'give full path' 'check syslog file' . These thing I have already checked but everything seems to be correct. So please help with the real solution. Thanx a lot in advance

asked 11 Jun '12, 01:54

UKS
3223
accept rate: 0%


You can see what's happening by logging the output of the cronjob to a file. This can be done by appending the following to your crontab line: >> /home/username/cron.log 2>&1

If this doesn't help you determine what the problem is, please open a ticket so we can take a look at this issue for you.

permanent link

answered 11 Jun '12, 02:07

todork
1.2k5
accept rate: 34%

edited 11 Jun '12, 08:39

seanf
12.2k41836

Hello Seanf, Thanks a lot for your suggestion. I tried with the line you mentioned to generate log file & it is working fine. In the log file output I came to know that cron is working fine but the problem is with the proxy setting & all. I am pasting here the output of the log file:-

Looking up 172.16.16.3:8080 Making HTTP connection to 172.16.16.3:8080 Sending HTTP request. HTTP request sent; waiting for response. Alert!: Invalid header 'Proxy-Authenticate: NTLM' Alert!: Invalid header 'Proxy-Authenticate: Kerberos' Alert!: Invalid header 'Proxy-Authenticate: Negotiate' Alert!: Can't retry with proxy authorization! Contact the server's WebMaster. Can't Access `http://localhost/jkportal/cron.php' Alert!: Unable to access document.

lynx: Can't access startfile

Now I would like to share that I have unset the proxy using unset http_proxy command already and my wget, lynx & a script which is calling lynx is working finwe through commandline but only through crontab file it is generating the above message. Please guide me about what to do next and if you require furthur details then please mention about it. Thanks a lot again.

(12 Jun '12, 07:44) UKS

You can try running wget with the --no-proxy parameter. If this doesn't help, please open a ticket, so we can take a look at your cronjob and try to troubleshoot it for you.

(12 Jun '12, 09:52) todork

Thanks Todork for your suggestions. Finally my cron is working. As suggested by you I tried with the no proxy option and it started running. So I got my solution. Thanks again for your inputs I hope I will learn a lot from you in future also. Thumbs Up

(13 Jun '12, 07:11) UKS

You are most welcome! Glad I could help.

(13 Jun '12, 07:12) todork

I am stuck with the same problem. Can you pls tell me where to use '--no-proxy' option? That would be glad.. I tried like this... wget -o wgetlog --output-document=wgettes.html --no-proxy "URL"

permanent link

answered 06 Oct '14, 11:19

Vasanth
1
accept rate: 0%

Try it like this: /usr/bin/wget -o wgetlog --output-document=wgettes.html --no-proxy "URL"

(06 Oct '14, 15:20) seanf
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×63
×50
×7
×2
×1

question asked: 11 Jun '12, 01:54

question was seen: 15,478 times

last updated: 06 Oct '14, 15:20

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM