You are not logged in.

#1 2010-09-25 01:52:08

BaconPie
Member
Registered: 2010-08-11
Posts: 209

Crond isn't running jobs

I've already looked at this thread but it contains no answers.

My crontab looks like this:

$ crontab -l
#* * * * * Command to be executed
#- - - - -
#| | | | |
#| | | | +----- Day of week (0-6)
#| | | +------- Month (1 - 12)
#| +--------- Day of month (1 - 31)
#| +----------- Hour (0 - 23)
#+------------- Min (0 - 59)

################################### EXAMPLES ###################################
# Run the `something` command every hour on the hour
#0 * * * * /sbin/something

# Run the `nightly` command at ten minutes past midnight every day
#10 0 * * * /bin/nightly

# Run the `monday` command every monday at 2 AM
#0 2 * * 1 /usr/local/bin/monday

# Use a range of hours matching 1, 2, 3 and 4AM
#* 1-4 * * * /bin/some-hourly

# Use a set of hours matching 1, 2, 3 and 4AM
#* 1,2,3,4 * * * /bin/some-hourly
################################################################################

# Tell the user about a backup
55 21 * * * /usr/bin/zenity --info --timeout=300 --title="Backup" --text="A backup will be started in 5 minutes at 21:00. Please turn on your backup device."

# Run the backup command at 21:00 everyday
00 22 * * * /home/tom/bin/backup -y > ~/bin/backup.log

# Display a message
41 21 * * * /usr/bin/zenity --info --text hello

The comments are for reference, the first two commands are for my backup and the last one is what I am using to to debug.

Pretty much what the title says really; they aren't running.

The daemon is being started on boot;

$ tail -n 1 /etc/rc.conf
DAEMONS=(acpid syslog-ng dbus !preload iptables @crond @wicd @sshd @sensors @ntpd @alsa)

My log contains a whole bunch of errors from a program I uninstalled a while ago; it left a file at /etc/cron.d/monitorx and I've only just cleaned it up.

Here is the log for the past few hours without the monitorx entries. Most of the sendmails are from that:

sudo less /var/log/crond.log | grep -v monitorix
...
...lots of log entries related to monitorix here...
...
Sep 24 20:20:01 localhost crond[3791]: failed parsing crontab for user root: PATH=/sbin:/bin:/usr/sbin:/usr/bin
Sep 24 20:52:01 localhost crond[3791]: failed parsing crontab for user root: PATH=/sbin:/bin:/usr/sbin:/usr/bin
Sep 24 21:22:01 localhost crond[3791]: failed parsing crontab for user root: PATH=/sbin:/bin:/usr/sbin:/usr/bin
Sep 24 21:34:01 localhost crond[3791]: FILE /var/spool/cron/root USER root PID 3845 job sys-hourly
Sep 24 21:41:01 localhost crond[3791]: FILE /var/spool/cron/tom USER tom PID 13194 /usr/bin/zenity --info --text hello
Sep 24 21:41:16 localhost crond[3791]: exit status 1 from user tom /usr/bin/zenity --info --text hello
Sep 24 21:41:16 localhost crond[13532]: mailing cron output for user tom /usr/bin/zenity --info --text hello
Sep 24 21:41:16 localhost crond[13532]: unable to exec /usr/sbin/sendmail: cron output for user tom /usr/bin/zenity --info --text hello to /dev/null
Sep 24 21:50:01 localhost crond[3791]: failed parsing crontab for user root: PATH=/sbin:/bin:/usr/sbin:/usr/bin
Sep 24 21:55:01 localhost crond[3791]: FILE /var/spool/cron/tom USER tom PID 31484 /usr/bin/zenity --info --timeout=300 --title="Backup" --text="A backup will be started in 5 minutes at 21:00. Please turn on your backup device."
Sep 24 21:55:16 localhost crond[3791]: exit status 1 from user tom /usr/bin/zenity --info --timeout=300 --title="Backup" --text="A backup will be started in 5 minutes at 21:00. Please turn on your backup device."
Sep 24 21:55:16 localhost crond[31820]: mailing cron output for user tom /usr/bin/zenity --info --timeout=300 --title="Backup" --text="A backup will be started in 5 minutes at 21:00. Please turn on your backup device."
Sep 24 21:55:16 localhost crond[31820]: unable to exec /usr/sbin/sendmail: cron output for user tom /usr/bin/zenity --info --timeout=300 --title="Backup" --text="A backup will be started in 5 minutes at 21:00. Please turn on your backup device." to /dev/null
Sep 24 22:00:01 localhost crond[3791]: FILE /var/spool/cron/tom USER tom PID 5400 /home/tom/bin/backup -y > ~/bin/backup.log
Sep 24 22:00:16 localhost crond[5751]: mailing cron output for user tom /home/tom/bin/backup -y > ~/bin/backup.log
Sep 24 22:00:16 localhost crond[5751]: unable to exec /usr/sbin/sendmail: cron output for user tom /home/tom/bin/backup -y > ~/bin/backup.log to /dev/null
Sep 24 22:17:01 localhost crond[3791]: failed parsing crontab for user root: PATH=/sbin:/bin:/usr/sbin:/usr/bin
Sep 24 22:47:01 localhost crond[3791]: failed parsing crontab for user root: PATH=/sbin:/bin:/usr/sbin:/usr/bin
Sep 24 22:58:22 localhost crond[3816]: /usr/sbin/crond 4.4 dillon's cron daemon, started with loglevel info
Sep 24 22:58:22 localhost crond[3816]: failed parsing crontab for user root: PATH=/sbin:/bin:/usr/sbin:/usr/bin
Sep 24 23:00:29 localhost crond[3812]: /usr/sbin/crond 4.4 dillon's cron daemon, started with loglevel info
Sep 24 23:00:29 localhost crond[3812]: failed parsing crontab for user root: PATH=/sbin:/bin:/usr/sbin:/usr/bin
Sep 24 23:14:33 localhost crond[3746]: /usr/sbin/crond 4.4 dillon's cron daemon, started with loglevel info
Sep 24 23:14:33 localhost crond[3746]: failed parsing crontab for user root: PATH=/sbin:/bin:/usr/sbin:/usr/bin
Sep 24 23:34:01 localhost crond[3746]: FILE /var/spool/cron/root USER root PID 25632 job sys-hourly
Sep 24 23:43:01 localhost crond[3746]: failed parsing crontab for user root: PATH=/sbin:/bin:/usr/sbin:/usr/bin
Sep 25 00:04:22 localhost crond[3820]: /usr/sbin/crond 4.4 dillon's cron daemon, started with loglevel info
Sep 25 00:04:22 localhost crond[3820]: failed parsing crontab for user root: PATH=/sbin:/bin:/usr/sbin:/usr/bin
Sep 25 00:34:01 localhost crond[3820]: failed parsing crontab for user root: PATH=/sbin:/bin:/usr/sbin:/usr/bin
Sep 25 00:58:05 localhost crond[3742]: /usr/sbin/crond 4.4 dillon's cron daemon, started with loglevel info
Sep 25 00:58:05 localhost crond[3742]: failed parsing crontab for user root: PATH=/sbin:/bin:/usr/sbin:/usr/bin
Sep 25 01:28:01 localhost crond[3742]: failed parsing crontab for user root: PATH=/sbin:/bin:/usr/sbin:/usr/bin
Sep 25 01:34:02 localhost crond[3742]: FILE /var/spool/cron/root USER root PID 16740 job sys-hourly
Sep 25 01:49:01 localhost crond[3742]: reading /var/spool/cron/cron.update
Sep 25 01:58:01 localhost crond[3742]: failed parsing crontab for user root: PATH=/sbin:/bin:/usr/sbin:/usr/bin
Sep 25 02:28:01 localhost crond[3742]: failed parsing crontab for user root: PATH=/sbin:/bin:/usr/sbin:/usr/bin

Also, I should mention that I don't have sendmail installed. I would like too but after searching for a while it seems it is not availible on arch/I have to install postfix which looks like some sort of full blown mail server. If anyone can throw in any advice on how to get this working too then that would be great. Sending emails from the command line in uni is great and I'd like to do it from home.

Anyway, crontab. It isn't working. Does anyone know why?

Offline

#2 2010-09-25 02:01:46

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: Crond isn't running jobs

Install exim. It provides sendmail for cron and requires zero setup. You don't even need to run the daemon.

Your log seems to disagree with your statement that jobs aren't running:

Sep 24 22:00:01 localhost crond[3791]: FILE /var/spool/cron/tom USER tom PID 5400 /home/tom/bin/backup -y > ~/bin/backup.log
Sep 24 22:00:16 localhost crond[5751]: mailing cron output for user tom /home/tom/bin/backup -y > ~/bin/backup.log

Offline

#3 2010-09-25 02:19:17

BaconPie
Member
Registered: 2010-08-11
Posts: 209

Re: Crond isn't running jobs

falconindy wrote:

Install exim. It provides sendmail for cron and requires zero setup. You don't even need to run the daemon.

Your log seems to disagree with your statement that jobs aren't running:

Sep 24 22:00:01 localhost crond[3791]: FILE /var/spool/cron/tom USER tom PID 5400 /home/tom/bin/backup -y > ~/bin/backup.log
Sep 24 22:00:16 localhost crond[5751]: mailing cron output for user tom /home/tom/bin/backup -y > ~/bin/backup.log
Sep 24 21:55:01 localhost crond[3791]: FILE /var/spool/cron/tom USER tom PID 31484 /usr/bin/zenity --info --timeout=300 --title="Backup" --text="A backup will be started in 5 minutes at 21:00. Please turn on your backup device."
Sep 24 21:55:16 localhost crond[3791]: exit status 1 from user tom /usr/bin/zenity --info --timeout=300 --title="Backup" --text="A backup will be started in 5 minutes at 21:00. Please turn on your backup device."
Sep 24 21:55:16 localhost crond[31820]: mailing cron output for user tom /usr/bin/zenity --info --timeout=300 --title="Backup" --text="A backup will be started in 5 minutes at 21:00. Please turn on your backup device."
Sep 24 21:55:16 localhost crond[31820]: unable to exec /usr/sbin/sendmail: cron output for user tom /usr/bin/zenity --info --timeout=300 --title="Backup" --text="A backup will be started in 5 minutes at 21:00. Please turn on your backup device." to /dev/null

It says exit status 1. That means there was an error.

I installed exim.

Last edited by BaconPie (2010-09-25 02:21:49)

Offline

#4 2010-09-25 11:51:19

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: Crond isn't running jobs

So the job that runs /home/tom/bin/backup is running? Because that's the one that I'm concerned about, not the zenity job. Perhaps you should have made your post more clear because it reads as though nothing is running.

Zenity needs to know about the DISPLAY you're running on and it needs the authority to access that display. Your cron job provides neither of these to zenity. There's plenty to be had if you google 'zenity cron'.

Offline

#5 2010-09-26 00:56:44

BaconPie
Member
Registered: 2010-08-11
Posts: 209

Re: Crond isn't running jobs

falconindy wrote:

So the job that runs /home/tom/bin/backup is running? Because that's the one that I'm concerned about, not the zenity job. Perhaps you should have made your post more clear because it reads as though nothing is running.

Zenity needs to know about the DISPLAY you're running on and it needs the authority to access that display. Your cron job provides neither of these to zenity. There's plenty to be had if you google 'zenity cron'.

Ah so it does, I never noticed that the backup script did not return an error. I guess I'll turn it into a script that exports the DISPALY and then displays a message.

Thanks for pointing that out; sometimes you just need someone else to see something before you realise the simple error. I'll post back if I get it fixed.

Cheers.

Offline

Board footer

Powered by FluxBB