Hello everyone. I've been having problems with cron running cron.daily jobs. I can't for the life of me figure it out and it is embarrassing and frustrating. First off cron doesn't log for shit. Sendmail wasn't running so I turned postfix on to see if mail shows up in root, it hasn't after 6 hours. I can see cron starting up in /var/log/messages, but that is it. I simply want to place a script called backup under cron.daily. So I run service cron restart, it checks /var/spool/tabs/ and /etc/crontab. The crontab is the default and should run cron.daily scripts. I've read that I need a file cron.daily under lastrun (which is empty now) so it's timestamp can be used. I've tried manually creating this and it doesn't work. Please HELP! Where do I look to see what is going wrong. I need hints. I *should* be able to reinstall cron, put a file under cron.daily, and sit back and relax (ie. cron.daily jobs are run by default on a fresh system with cron), but this doesn't work. Cron seems to be running (ie, sleeping, but not zombie or defunct). According to timestamps it is not reading any files in the system every 15 minutes and it should at least look in lastrun I believe. Here's some debug info. I restarted cron at 11:01 and it is a fresh install (uninstalled through yast, then reinstalled) dendrite:/var/spool # ls -lu /etc/cron.daily/ total 52 -rwxr-xr-x 1 root root 409 2007-05-07 16:10 backup -rwxr-xr-x 1 root root 2928 2007-05-03 15:55 beagle-crawl-system -rwxr-xr-x 1 root root 393 2007-05-03 15:55 logrotate -rwxr--r-- 1 root root 948 2007-05-03 15:55 suse-clean_catman tail /var/log/cron | grep -i cron May 8 11:01:35 dendrite /usr/sbin/cron[8398]: (CRON) STARTUP (V5.0) dendrite:/var/spool # ls -lu /var/spool/cron/ total 0 drwxr-xr-x 2 root root 80 2007-05-06 04:00 lastrun drwx------ 2 root root 48 2007-05-08 11:01 tabs dendrite:/var/spool # ls -lu /etc/crontab -rw-r--r-- 1 root root 274 2007-05-08 11:01 /etc/crontab dendrite:/var/spool # cat /etc/crontab SHELL=/bin/sh PATH=/usr/bin:/usr/sbin:/sbin:/bin:/usr/lib/news/bin MAILTO=root # # check scripts in cron.hourly, cron.daily, cron.weekly, and cron.monthly # -*/15 * * * * root test -x /usr/lib/cron/run-crons && /usr/lib/cron/run-crons > /dev/null 2>&1 dendrite:/var/spool # ls -lu /var/spool/cron/tabs/ total 0 dendrite:/var/spool # ps -Al | grep cron 1 S 0 8398 1 0 78 0 - 494 - ? 00:00:00 cron dendrite:/var/spool # ps -Al | grep syslog 5 S 0 3023 1 0 75 0 - 1239 - ? 00:00:19 syslog-ng 5 S 0 3043 1 0 75 0 - 430 syslog ? 00:00:14 klogd dendrite:/var/spool # cat /etc/cron.daily/backup #!/bin/sh date >> /var/log/backup.log mount -v /backup >> /var/log/backup.log rsync -au / /backup/ --exclude ppg --exclude fmri --exclude /Network/people --exclude /backup --exclude /sys --exclude /proc --exclude /var/tmp --exclude /backup --exclude /home/bruss/external_mp3.dir --exclude /mnt >> /var/log/backup.log umount /backup >> /var/log/backup.log echo "backup complete" >> /var/log/backup.log dendrite:/var/spool # Perhaps I should compile it from source, this is a yast binary. Thanks alot for the help. Nick -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Nick Jones wrote:
Hello everyone.
I've been having problems with cron running cron.daily jobs. I can't for the life of me figure it out and it is embarrassing and frustrating.
First off cron doesn't log for shit. Sendmail wasn't running so I turned postfix on to see if mail shows up in root, it hasn't after 6 hours. I can see cron starting up in /var/log/messages, but that is it. I simply want to place a script called backup under cron.daily
The cron script can be set to send a report via e-Mail, setting the variable SEND_MAIL_ON_NO_ERROR to yes will setup a mail address for all jobs. Now on my 64bit machine this variable turned up in YasT in system-->/etc/sysconfig Editor but it looks as if was placed in the /etc/sysconfig/cron file because I was using it on the system already. You can try adding the line SEND_MAIL_ON_NO_ERROR=yes in the /etc/sysconfig/cron file, or add the line to the /usr/lib/cron/run-crons script. This is a bit of pain because you get messages for the hourly cron jobs and I run a modified run-cron script that only does this for daily or monthly cron jobs. (Thinking of modifying it further to send a daily digest plus error mails). Cron does some basic syslogging ... but nothing very detailed. .
So I run service cron restart, it checks /var/spool/tabs/ and /etc/crontab. The crontab is the default and should run cron.daily scripts. I've read that I need a file cron.daily under lastrun (which is empty now) so it's timestamp can be used. I've tried manually creating this and it doesn't work.
This is a lock file... If there are executable files this file is created for each of the cron.<time> directories. To force the daily scripts to run use touch to create the cron.daily file at least 24 hours before the current time. Otherwise it will effectively block exuction for 24 hours.
Please HELP! Where do I look to see what is going wrong. I need hints. I *should* be able to reinstall cron, put a file under cron.daily, and sit back and relax (ie. cron.daily jobs are run by default on a fresh system with cron), but this doesn't work. Cron seems to be running (ie, sleeping, but not zombie or defunct). According to timestamps it is not reading any files in the system every 15 minutes and it should at least look in lastrun I believe.
Here's some debug info. I restarted cron at 11:01 and it is a fresh install (uninstalled through yast, then reinstalled)
dendrite:/var/spool # ls -lu /etc/cron.daily/ total 52 -rwxr-xr-x 1 root root 409 2007-05-07 16:10 backup -rwxr-xr-x 1 root root 2928 2007-05-03 15:55 beagle-crawl-system -rwxr-xr-x 1 root root 393 2007-05-03 15:55 logrotate -rwxr--r-- 1 root root 948 2007-05-03 15:55 suse-clean_catman
tail /var/log/cron | grep -i cron May 8 11:01:35 dendrite /usr/sbin/cron[8398]: (CRON) STARTUP (V5.0)
dendrite:/var/spool # ls -lu /var/spool/cron/ total 0 drwxr-xr-x 2 root root 80 2007-05-06 04:00 lastrun drwx------ 2 root root 48 2007-05-08 11:01 tabs
dendrite:/var/spool # ls -lu /etc/crontab -rw-r--r-- 1 root root 274 2007-05-08 11:01 /etc/crontab
dendrite:/var/spool # cat /etc/crontab SHELL=/bin/sh PATH=/usr/bin:/usr/sbin:/sbin:/bin:/usr/lib/news/bin MAILTO=root # # check scripts in cron.hourly, cron.daily, cron.weekly, and cron.monthly # -*/15 * * * * root test -x /usr/lib/cron/run-crons && /usr/lib/cron/run-crons > /dev/null 2>&1
dendrite:/var/spool # ls -lu /var/spool/cron/tabs/ total 0
dendrite:/var/spool # ps -Al | grep cron 1 S 0 8398 1 0 78 0 - 494 - ? 00:00:00 cron dendrite:/var/spool # ps -Al | grep syslog 5 S 0 3023 1 0 75 0 - 1239 - ? 00:00:19 syslog-ng 5 S 0 3043 1 0 75 0 - 430 syslog ? 00:00:14 klogd
dendrite:/var/spool # cat /etc/cron.daily/backup #!/bin/sh
date >> /var/log/backup.log
mount -v /backup >> /var/log/backup.log
rsync -au / /backup/ --exclude ppg --exclude fmri --exclude /Network/people --exclude /backup --exclude /sys --exclude /proc --exclude /var/tmp --exclude /backup --exclude /home/bruss/external_mp3.dir --exclude /mnt >> /var/log/backup.log
umount /backup >> /var/log/backup.log
echo "backup complete" >> /var/log/backup.log
dendrite:/var/spool #
Perhaps I should compile it from source, this is a yast binary. Thanks alot for the help.
Nick
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org iD8DBQFGQX9VasN0sSnLmgIRAqhPAJ48UK3N8zSd90ICwcyNrANWi/nNQwCfSYOp L46df5VUjZGm+RV6zJLKMCg= =82w7 -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 The Tuesday 2007-05-08 at 15:13 -0500, Nick Jones wrote:
I've been having problems with cron running cron.daily jobs. I can't for the life of me figure it out and it is embarrassing and frustrating.
You simply need to place an executable script in the cron.daily dir. These are run by the "/usr/lib/cron/run-crons" script: you can examine it to see how it works. For example, if it is a laptop on batery, it will not run. You could edit the file so that it logs a message to syslog when it runs or runs something; loo for this line: nice -n ${CRON_SCRIPT_NICE_VALUE} $SCRIPT >$TEMP_MSG 2>&1 You could add below a call to "logger" to log a messge of your choice for each script. Or you could define the variable "SYSLOG_ON_NO_ERROR" to yes (/etc/sysconfig/cron).
So I run service cron restart, it checks /var/spool/tabs/ and /etc/crontab. The crontab is the default and should run cron.daily scripts. I've read that I need a file cron.daily under lastrun (which is empty now) so it's timestamp can be used. I've tried manually creating this and it doesn't work.
That file /dissables/ the script for 24 hours.
According to timestamps it is not reading any files in the system every 15 minutes and it should at least look in lastrun I believe.
It doesn't read, it checks timestamps of the directory. If this stamp changes, then it reads those crontab files. - -- Cheers, Carlos E. R. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) Comment: Made with pgp4pine 1.76 iD8DBQFGQaFTtTMYHG2NR9URAoIVAKCP2gdd0fTdqbJ/OeTf5x8Xqo2pUQCfU0CF Xv3+PMpqFItw+iiK4Gae1zI= =P9pX -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (3)
-
Carlos E. R.
-
G T Smith
-
Nick Jones