View previous topic :: View next topic |
Author |
Message |
dageyra Apprentice
Joined: 22 Feb 2005 Posts: 194 Location: Terre Haute, IN
|
Posted: Wed Jun 25, 2008 5:16 pm Post subject: Cron tasks not running (or email not being sent) [SOLVED] |
|
|
For some reason, my cron tasks are not running, or I'm not getting notification that it is. I have it setup as such where I get an email with the output of the cron jobs:
Code: |
$ cat /etc/crontab
# for vixie cron
#
# $Header: /var/cvsroot/gentoo-x86/sys-process/vixie-cron/files/crontab-3.0.1-r4,v 1.1 2005/03/04 23:59:48 ciaranm Exp $
#
#
# Global variables
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=ryan@dagey.com
HOME=/
# check scripts in cron.hourly, cron.daily, cron.weekly and cron.monthly
0 * * * * root rm -f /var/spool/cron/lastrun/cron.hourly
#56 15 * * * root rm -f /var/spool/cron/lastrun/cron.daily
1 3 * * * root rm -f /var/spool/cron/lastrun/cron.daily
15 4 * * 6 root rm -f /var/spool/cron/lastrun/cron.weekly
30 5 1 * * root rm -f /var/spool/cron/lastrun/cron.monthly
*/10 * * * * root test -x /usr/sbin/run-crons && /usr/sbin/run-crons
|
But I never get the email. Further, using cron.daily as a base (because it does my spam updatting), none of the scripts in /etc/cron.daily seem to run. I have a script spam_check.sh that removes all spam from user's mailboxes in a special folder called Spam that is older than 3 days. If I run this script manually, it works fine. Running the run-parts on /etc/cron.daily works fine, but the spam files are not deleted and I never get an email.
I do see the following as far as /var/spool/cron is concerned:
Code: |
# ls -l /var/spool/cron/
total 8
drwx-wx--T 2 root crontab 4096 Sep 11 2007 crontabs
drwxr-x--- 2 root root 4096 Jun 25 13:00 lastrun
|
Which shows the lastrun file is being updated properly.
Suggestions on how to determine what is not working properly?
Last edited by dageyra on Tue Jul 15, 2008 1:13 am; edited 1 time in total |
|
Back to top |
|
|
smerf l33t
Joined: 06 Nov 2004 Posts: 778 Location: Polska
|
Posted: Wed Jun 25, 2008 10:20 pm Post subject: |
|
|
Can you send mail using 'mail' commandline utility?
Have you tried to put some talkative job directly inside crontab?
Is there anything cron-related in logs (try grep cron /var/log/ -r | less)? _________________ Microsoft is not the answer, Microsoft is the question, the answer is no. |
|
Back to top |
|
|
dageyra Apprentice
Joined: 22 Feb 2005 Posts: 194 Location: Terre Haute, IN
|
Posted: Sun Jun 29, 2008 1:56 am Post subject: |
|
|
smerf wrote: | Can you send mail using 'mail' commandline utility?
Have you tried to put some talkative job directly inside crontab?
Is there anything cron-related in logs (try grep cron /var/log/ -r | less)? |
Thanks for all your help.
There are several crontab jobs that spit out stuff. When I run the commands directly via the "test -x ...", I see the output.
The command 'mail' is unknown, I use postfix for my MTA, could that be a culprit?
It does appear like cron is working, but as I said, the spam folder is not being removed via tmpwatch and portage doesn't get updated, two scripts that work when executed directly:
Code: |
/var/log/syslog:Jun 28 21:00:01 dev cron[28054]: (root) CMD (test -x /usr/sbin/run-crons && /usr/sbin/run-crons )
/var/log/syslog:Jun 28 21:00:01 dev cron[28056]: (root) CMD (rm -f /var/spool/cron/lastrun/cron.hourly)
/var/log/syslog:Jun 28 21:01:01 dev cron[28077]: (dageyra) CMD (/data/bittorrent/watch/aim2torrent )
/var/log/syslog:Jun 28 21:06:01 dev cron[28119]: (dageyra) CMD (/data/bittorrent/watch/aim2torrent )
/var/log/syslog:Jun 28 21:10:01 dev cron[28131]: (root) CMD (test -x /usr/sbin/run-crons && /usr/sbin/run-crons )
/var/log/syslog:Jun 28 21:11:01 dev cron[28143]: (dageyra) CMD (/data/bittorrent/watch/aim2torrent )
/var/log/syslog:Jun 28 21:16:01 dev cron[28155]: (dageyra) CMD (/data/bittorrent/watch/aim2torrent )
/var/log/syslog:Jun 28 21:20:01 dev cron[28174]: (root) CMD (test -x /usr/sbin/run-crons && /usr/sbin/run-crons )
/var/log/syslog:Jun 28 21:21:01 dev cron[28186]: (dageyra) CMD (/data/bittorrent/watch/aim2torrent )
/var/log/syslog:Jun 28 21:26:01 dev cron[28236]: (dageyra) CMD (/data/bittorrent/watch/aim2torrent )
/var/log/syslog:Jun 28 21:30:01 dev cron[28258]: (root) CMD (test -x /usr/sbin/run-crons && /usr/sbin/run-crons )
/var/log/syslog:Jun 28 21:31:01 dev cron[28270]: (dageyra) CMD (/data/bittorrent/watch/aim2torrent )
/var/log/syslog:Jun 28 21:36:01 dev cron[28298]: (dageyra) CMD (/data/bittorrent/watch/aim2torrent )
/var/log/syslog:Jun 28 21:40:01 dev cron[28317]: (root) CMD (test -x /usr/sbin/run-crons && /usr/sbin/run-crons )
/var/log/syslog:Jun 28 21:41:01 dev cron[28342]: (dageyra) CMD (/data/bittorrent/watch/aim2torrent )
|
Any further tips/suggestions? |
|
Back to top |
|
|
bunder Bodhisattva
Joined: 10 Apr 2004 Posts: 5935
|
Posted: Sun Jun 29, 2008 2:16 am Post subject: |
|
|
do you have ssmtp installed and configured? i'd also run "find / | grep dead.letter" to see if the mails are still stored somewhere on the fs (might be /home/user, might be /var/spool, it's been a while).
i'd also try dropping the variables from your crontab, but i use dcron, so i'm not sure if you really need them. (ssmtp does the MAILTO, and the rest should be automatic)
what are the permissions on the /etc/cron.daily/scripts you added? note: your cron.daily is commented out in your sample.
cheers _________________
Neddyseagoon wrote: | The problem with leaving is that you can only do it once and it reduces your influence. |
banned from #gentoo since sept 2017 |
|
Back to top |
|
|
dageyra Apprentice
Joined: 22 Feb 2005 Posts: 194 Location: Terre Haute, IN
|
Posted: Mon Jun 30, 2008 3:48 am Post subject: |
|
|
bunder wrote: | do you have ssmtp installed and configured? i'd also run "find / | grep dead.letter" to see if the mails are still stored somewhere on the fs (might be /home/user, might be /var/spool, it's been a while).
i'd also try dropping the variables from your crontab, but i use dcron, so i'm not sure if you really need them. (ssmtp does the MAILTO, and the rest should be automatic)
what are the permissions on the /etc/cron.daily/scripts you added? note: your cron.daily is commented out in your sample.
cheers |
Thanks for your suggestions and help.
ssmtp was not installed/configured, I believe because when I set this server up, ssmtp & postfix blocked each other. When I install ssmtp and run etc-config, it wants to set my MTA to be ssmtp and not postfix--I don't want this to happen as everything is working fine with Postfix for my users. Should I have both ssmtp & postfix installed?
"find / | grep dead.letter" returns nothing
I commented out the extra variables in crontab, leaving only MAILTO so that I can continue testing. We'll see after the cron.daily scripts run if that had any effect.
Regarding permissions on /etc/cron.daily:
Code: |
$ ls -la /etc/cron.daily/
total 40
drwxr-xr-x 2 root root 4096 Jun 25 13:48 .
drwxr-xr-x 58 root root 4096 Jun 29 23:31 ..
-rw-r--r-- 1 root root 0 Apr 8 2006 .keep
-rwxr-xr-x 1 root root 26 Sep 20 2006 chkrootkit
-rwxr-xr-x 1 root root 52 Apr 13 2007 logrotate.cron
-rwxr-xr-x 1 root root 115 Jun 25 13:48 makewhatis
-rwxr-xr-x 1 root root 418 Apr 26 2006 makewhatis.cron
-rwxr-xr-x 1 root root 152 May 3 2006 slocate
-rwxr-xr-x 1 root root 2240 Oct 29 2006 spam_check.sh
-rwxr-xr-x 1 root root 1924 Nov 24 2007 tmpwatch
-rwxr-xr-x 1 root root 259 Apr 26 2006 update_portage.cron
|
I had a test cron.daily in the crontab, there are two in the sample I provided, one is commented out, one is not. The one that is not is the Gentoo default.
Any other ideas? I can't let you know if these changes had any effect until tomorrow, I will post an update then. |
|
Back to top |
|
|
bunder Bodhisattva
Joined: 10 Apr 2004 Posts: 5935
|
Posted: Mon Jun 30, 2008 4:34 am Post subject: |
|
|
Quote: | I had a test cron.daily in the crontab, there are two in the sample I provided, one is commented out, one is not. The one that is not is the Gentoo default. |
my bad, i was tired.
let us know how things turn out.
cheers _________________
Neddyseagoon wrote: | The problem with leaving is that you can only do it once and it reduces your influence. |
banned from #gentoo since sept 2017 |
|
Back to top |
|
|
dageyra Apprentice
Joined: 22 Feb 2005 Posts: 194 Location: Terre Haute, IN
|
Posted: Mon Jun 30, 2008 4:37 am Post subject: |
|
|
bunder wrote: | Quote: | I had a test cron.daily in the crontab, there are two in the sample I provided, one is commented out, one is not. The one that is not is the Gentoo default. |
my bad, i was tired.
let us know how things turn out.
cheers |
no problem. am i incorrect in believing i should only have ssmtp or postfix installed, not both? |
|
Back to top |
|
|
bunder Bodhisattva
Joined: 10 Apr 2004 Posts: 5935
|
Posted: Mon Jun 30, 2008 5:29 am Post subject: |
|
|
seems that way, but i still have a ssmtp.conf on my mail server... not sure if its actually being used or not, couldn't say.
cheers _________________
Neddyseagoon wrote: | The problem with leaving is that you can only do it once and it reduces your influence. |
banned from #gentoo since sept 2017 |
|
Back to top |
|
|
dageyra Apprentice
Joined: 22 Feb 2005 Posts: 194 Location: Terre Haute, IN
|
Posted: Wed Jul 02, 2008 6:31 pm Post subject: |
|
|
Still no email from cron, but I have determined that I believe is scripts are running. I've added a simple output script:
Code: |
$ cat /etc/cron.hourly/echo
echo test
|
I've updated my crontab:
Code: |
$ cat /etc/crontab
# for vixie cron
#
# $Header: /var/cvsroot/gentoo-x86/sys-process/vixie-cron/files/crontab-3.0.1-r4,v 1.1 2005/03/04 23:59:48 ciaranm Exp $
#
#
# Global variables
#SHELL=/bin/bash
#PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
#HOME=/
# check scripts in cron.hourly, cron.daily, cron.weekly and cron.monthly
0 * * * * root rm -f /var/spool/cron/lastrun/cron.hourly
#56 15 * * * root rm -f /var/spool/cron/lastrun/cron.daily
1 3 * * * root rm -f /var/spool/cron/lastrun/cron.daily
15 4 * * 6 root rm -f /var/spool/cron/lastrun/cron.weekly
30 5 1 * * root rm -f /var/spool/cron/lastrun/cron.monthly
*/10 * * * * root test -x /usr/sbin/run-crons && /usr/sbin/run-crons
|
But I haven't gotten anything. Any further suggestions? |
|
Back to top |
|
|
dageyra Apprentice
Joined: 22 Feb 2005 Posts: 194 Location: Terre Haute, IN
|
Posted: Tue Jul 15, 2008 1:13 am Post subject: |
|
|
Solved the problem. "sendmail" didn't exist, but "sendmail.postfix" did, no idea why. I just linked sendmail to sendmail.postfix, now I get my cron emails. |
|
Back to top |
|
|
KWhat l33t
Joined: 04 Sep 2005 Posts: 648 Location: Los Angeles
|
|
Back to top |
|
|
|