LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   cron problems (https://www.linuxquestions.org/questions/linux-newbie-8/cron-problems-486623/)

wgato 09-24-2006 08:25 PM

cron problems
 
anyone have any suggestions?
i'm having a hard time getting cron to work using ubuntu dapper server

i tried using crontab -e as the user wg and adding the line:
* * * * * wg /home/wg/ghostbin/test

where the text of test is:
#!/bin/sh
echo "cron test" >> /home/wg/ghostbin/crontest.txt

didnt work. then i changed to root and did tried the same thing with crontab -e. no good.

i also tried puting test in /etc/cron.hourly, though i'd like more control over when it runs than that. but it didnt work anyway.

i restarted cron. then stopped it & started it again. rebooted the machine.

btw running 'echo "cron test" >> /home/wg/ghostbin/crontest.txt' at the command line does work.

i'm not sure what else to try. any ideas?

Berhanie 09-24-2006 09:45 PM

Make sure crontest.txt has execute permissions?

wgato 09-24-2006 10:07 PM

thanks for the suggestion

none of my other cronjobs are running either, this was just my simple test to try to isolate the problem

but i'll try creating crontest.txt myself and manually setting the permissions.

thanks!

Berhanie 09-24-2006 10:16 PM

The syntax for a user's crontab is:
Code:

* * * * * /home/wg/ghostbin/test
Note that there is no field for the user. That's more likely
the problem. Check the logs.

wgato 09-24-2006 10:53 PM

i tried chmod 777 crontest.txt and removing the username from the the crontab. neither worked.

which logs are you refering to?

Berhanie 09-24-2006 11:00 PM

Quote:

which logs are you refering to?
It may be something like /var/log/cron, but check /etc/syslog.conf if you're not sure. cron should also send you an email whenever there's an error message (but, you need to have configured a mail server for that -- otherwise, the mail just stays in queue).

Sorry: it's /home/wg/ghostbin/test not /home/wg/ghostbin/crontest.txt that should have execute perms.

wgato 09-24-2006 11:13 PM

thank you for all your suggestions, i appreciate the time

/home/wg/ghostbin/test has the correct permissions because it runs ok from the command line.

i didnt see /var/log/cron and when i checked /etc/syslog.conf, i found:
#cron.* /var/log/cron.log
daemon.* -/var/log/daemon.log
kern.* -/var/log/kern.log

so cron is commented out and doesnt have - in front of the directory like daemon and kern. weird.

Berhanie 09-24-2006 11:16 PM

Just uncomment it and give syslogd a sighup:
Code:

kill -HUP `cat /var/run/syslogd.pid`


All times are GMT -5. The time now is 10:13 PM.