I am attempting to create a crontab in order to automatically update over 200 external RSS feeds on my drupal based site.
I thought I was doing it right (well, guess not since it's not working) but I need someone with a good level of expertise to see what I am doing wrong.
First off, I made sure I could create a crontab with my host. Following their instructions:
1. I used telnet to get into my shell
2.typed crontab -e
3. in VI, typed i
and used as crontab instructions: 50 * * * * /home/www/scripts/cron-lynx.sh
, closed off with escape and wq. I verified with crontab -l that the cron had been created. My intent is to run the cron-lynx.sh 50 minutes past every hour.
4. I made sure cron-lynx.sh contained the actual path to the drupal cron file on my host.
and I waited, and waited...and waited. No error message in drupal, nothing. Nothing happened.
What am I doing wrong? Am I missing something?
Comments
What's in cron-lynx.sh?
Assuming that you're using vixie cron, it looks like your crontab entry is just fine. So that leaves two classes of problems you need to check for:
I'm also assuming that /home/www/scripts is readable to your user. If that isn't true, then that's another problem you could be having.
Rob Thorne
Torenware Networks
Ambiguous Redirect
I manually executed the cron-lynx.sh script and I'm getting the following:
: ambiguous redirect
The cron.lynx.sh script reads:
My gut feels tells me it's related to the
/dev/null 2>&1
portion of the code but I have no clue as to what I should adjust to make the script (and cron) run properly.Any ideas?
Anyone?
Anyone?
have you tried it otherwise
I Have you confirmed that lynx works from the command line. For example,
/usr/bin/lynx http://drupal.org/
should bring you to the Drupal website in lynx. You an can also test it the same way with your cron address
/usr/bin/lynx http://example.com/cron.php
And your cron should update. If it doesn't, then perhaps the path is wrong for executing lynx. However, if that works, then perhaps it is the /dev/null 2>&1 portion of the script code.
Interesting...
Okay, well this is interesting indeed.
First the good news:
/usr/bin/lynx http://example.com/cron.php
executes problem free and the drupal logs show indeed that cron was updated.Now the persistant bad news:
Seems to me that the issue is with cron-lynx.sh but what it is...? I've been googling
/dev/null 2>&1
for solutions but with no avail.could be your cron script
Before figuring out whether /dev/null 2>&1 is the problem, I would check to see whether the cron-lynx.sh script is being run via your server logs.
looks okay
i use wget which has a "quiet" option, like
/usr/bin/wget -O - -q http://www.example.com/cron.php
my best quess is that you are using the csh for your crontab instead of hash bang slash bin slash sh
btw: allways tail logging when troubleshooting and use google with the errormessages.
--
groets
bertb
--
groets
bert boerland
Solved
Okay, I got it running. I ended up applying Bert's suggestion of using wget and adjusted the cron with the exact code (welll, replacing www.example.com with my site) and it works like a champ.
Thanks to everyone who contributed.
Redirection
/usr/bin/lynx -source http://www.myowndomain.com/cron.php > /dev/null 2>&1 says ...
"run lynx with the -source option;
redirect standard output to /dev/null,
and redirect errors to the standard output file handle (therefore also to /dev/null)."
It works fine with bash. What sort of system are you running this on? What is the output of "/bin/sh --version"?
/dev/null bit
That is to send the output into the deep dark void and probably isn' t causing the problem. More likely cron isn't authorized to execute the script.
- Robert Douglass
-----
Rate the value of this post: http://rate.affero.net/robertDouglass/
I recommend CivicSpace: www.civicspacelabs.org
My sites: www.hornroller.com, www.robshouse.net
I had the same problem, but
I had the same problem, but I have my host stup to mail me logs when things go wrong. Mine told me that the script permissions were denied. To correct this I simply:
chmod 755 scriptname
PoorMansCron
What is wrong about just using poormanscron?
Regards,
Czar ['at'] Czarism.com
Nothing
poormanscron is a great module..but I wanted to have the crontab working.