Ubuntu – User cron jobs are not running but system jobs are

cronslicehostUbuntu

wouldn't be posting here if I hadn't tried everything I could find on the interwebs…would appreciate any guidance from a seasoned sysadmin.

Here is my problem: cron jobs in /etc/cron.daily, /etc/cron.hourly etc. are running fine on my Slicehost Ubuntu server — their execution is being logged to both /var/log/syslog and /var/log/cron.log

I've created two test cron jobs, one as root and one as an admin user, through crontab that are supposed to run every minute. Here is the output of crontab -l run as root

$ crontab -l
* * * * * /bin/date > /tmp/unicorns
$ crontab -u neil0 -l
* * * * * /home/neil0/crontab/unicorn.sh >> /home/neil0/logs/crontab.log >&1

EDIT 1: I didn't copy this exactly…there was no newline in the output and that was the source of the problem

here are the contents of unicorn.sh

#!/bin/sh
echo 'UNICORNS'

but neither /home/neil0/logs/crontab.log nor /tmp/unicorns is being updated, and there is no record of these jobs being run in /var/log/syslog or /var/log/cron.log!

before you ask, it does appear that cron is running —

$ ps aux | grep cron
root      1588  0.0  0.1  18616   980 ?        Ss   12:31   0:00 /usr/sbin/cron
root      1798  0.0  0.1   3944   604 pts/0    R+   13:01   0:00 grep cron

in case you were wondering 'unicorn' is my replacement frustration word for 'F***' ever since a certain debugging snafu with a live website sooooo as you can see i'm pretty much at my wits end here. any help would be greatly appreciated.

Best Answer

uh...huh. so as I'm guessing most of you already know, you need to end your crontab files with a newline. that was the whole issue. hope this helps someone else

Related Topic