Crontab not working for non-root User
Hello, I can't get cron working for a non-root user.
Here's the result of crontab -l for user 'nihi': Code:
57 12 * * * /bin/date > /home/nihi/logs/testdate Code:
nihi Root's crontab does work. Here's the result of crontab -l for root: Code:
# m h dom mon dow command I'm running Ubuntu 9.10(despite my forum username). Am I missing something obvious? Thanks for any help! |
Err... I should add that the crontab for nihi doesn't create a 'testdate' file in /home/nihi/logs/. Which is kind of the crux of the problem, but one I forgot to mention in my post.
|
Well, there seem to be a ton of the 'crontab don't work' type of posts, so I'll give my solution.
I was trying to run offlineimap every five minutes... even if I'd got crontab to work, I'd probably have issues with user environments and so on. What I did instead was write a recursive script using at. The script is /home/nihi/atscripts/recursive-email.sh, and it contains: Code:
offlineimap Code:
cat /home/nihi/atscripts/recursive-email.sh | at now |
I don't use Ubuntu, but I'd check other logs eg /var/log/messages. There should be logs of all cron jobs run, regardless of success or failure.
Also, if cron has an issue, it should email the job owner or root. Try mailx from the cmd line as each user. |
Make sure there is an empty line as last line in your crontab file. Furthermore you should find a message in /var/log/syslog if something goes wrong. The missing empty line in the file will not show up as an error in syslog.
jlinkels |
The lack of an empty line in the crontab file was the problem. It all works now. Thank you very much jlinkels.
|
All times are GMT -5. The time now is 10:08 PM. |