Why can't I get cron to work?

plarkin

Registered
I've set up a MacOS X (client version) box to do various webserverving tasks. It uses mysql and php. I've successfully moved most of my apps over but I cannot for the life of me get cron to do anything!

I have a crontab setup to run 3 scripts. I've tested them at various points in the day and none get executed. These scripts were all moved from a LinuxPPC machine and have been edited for the new system. They are all VERY simple. Copying files here and there and importing data into dbs.

Am I missing something??
 
First thing I'd look at is /var/log/system.log as cron logs info there when it does stuff. Just after your script should run, check that and see if something useful is shown.
 
I checked the log. None of the shell scripts executed at all. Only one thing executed and that was a simple command to mail me a log file. (Although it executed, the mail.log show that it was sent to /dev/null rather than the To: recipient I entered. Aaagh!)
 
Also, what user are you running the jobs as? By default, mail for root is automatically forwarded to /dev/null with the .forward file in /var/root/
 
OK, I think I found the problem with my scripts not running. On my LinuxPPC machine, I used

#!/bin/bash

at the top. I changed that to /bin/sh and it worked (I think). I'll see tomorrow since most will run through the night.

Mail going to /dev/null is another issue I'll have to look into. The mail wasn't being sent to root but to an outside address. I have verified that sendmail is working via php scripts...
 
by the way...

should i NOT run cron jobs as root? I always do so I don't have to worry about permissions or anything...
 
Back
Top