Home › Forums › OS X Server and Client Discussion › Questions and Answers › cron job not executing in MACOSXS 10.3
- This topic has 3 replies, 2 voices, and was last updated 21 years, 2 months ago by
Bill Eccles.
-
AuthorPosts
-
January 13, 2004 at 5:04 pm #357195
Bill Eccles
ParticipantGentleones,
In OSXS 10.3, I’ve added one line to my /etc/crontab, below:
[code:1:26fe26a6a9]0,15,30,45 * * * * root /usr/sbin/learnspam [/code:1:26fe26a6a9]
(There are tabs between each of the items in the above table.)
As you can see, the /etc/crontab file has kept its permissions and ownerships:
[code:1:26fe26a6a9]-r–r–r– 1 root wheel 339 7 Jan 07:13 /etc/crontab [/code:1:26fe26a6a9]
I know that it is still in working order because daily.out gets updated by /usr/sbin/periodic when it should.
And you can see that the script being called has correct (as best I can tell–they match /usr/sbin/periodic) permissions, too:
[code:1:26fe26a6a9]-r-xr-xr-x 1 root wheel 851 5 Jan 15:43 /usr/sbin/learnspam [/code:1:26fe26a6a9]
(The script is at the bottom of this post.) Furthermore, I can execute the script manually with no errors with “sudo /usr/sbin/learnspam”.
But the sa-learn.log file shows no activity (it’s there, owned by root, and reflects changes when I manually invoke learnspam), and indeed, none has occurred because, as reported by sa-learn, the spam builds up until I manually execute the learnspam script.
Anyone got some clues on this one?
Many thanks,
Billlearnspam:
[code:1:26fe26a6a9]#!/bin/sh –
SPAM=/var/spool/imap/reportspam/*.
HAM=/var/spool/imap/reportnotspam/*.
LOGFILE=/var/log/sa-learn.logecho ‘ ‘ >> $LOGFILE
echo "********************* Learnspam run starting " >> $LOGFILE
date +%Y-%m-%d+%H:%M:%S >> $LOGFILE
echo ‘ ‘ >> $LOGFILE
echo ‘Learning as spam:’ >> $LOGFILE
sa-learn –spam /var/spool/imap/user/reportspam/*. >> $LOGFILE 2>&1rm /var/spool/imap/user/reportspam/[0-9]*
sudo -u cyrus /usr/bin/cyrus/bin/reconstruct user/reportspamecho ‘ ‘ >> $LOGFILE
echo ‘Learning as ham:’ >> $LOGFILEsa-learn –ham /var/spool/imap/user/reportnotspam/*. >> $LOGFILE 2>&1
rm /var/spool/imap/user/reportnotspam/[0-9]*
sudo -u cyrus /usr/bin/cyrus/bin/reconstruct user/reportnotspamecho ‘ ‘ >> $LOGFILE
echo ‘Script learnspam done.’ >> $LOGFILE# /usr/local/bin/sa-learn –rebuild -p /var/amavis/.spamassassin/user_prefs[/code:1:26fe26a6a9]
January 30, 2004 at 7:16 pm #357298Anonymous
ParticipantTry writing your cron entry like this:
[code:1:5089f52247]
*/15 * * * * sh /usr/sbin/learnspam
[/code:1:5089f52247]January 31, 2004 at 2:11 am #357300Bill Eccles
ParticipantI did as you suggested with no change to the operation (or lack thereof, really) in the cron jobs executed (or not).
This one’s got me stumped.
Many thanks!
January 31, 2004 at 5:14 pm #357303Bill Eccles
ParticipantIf there’s not a trailing <CR> (or maybe it’s <CR><LF>… anyway…) at the end of the last line of the file, cron won’t read it.
To make sure everything’s cool, I added a comment line to become the last line of the file.
Yikes. That was tough!
Thanks for thinking about it, all,
Bill -
AuthorPosts
- You must be logged in to reply to this topic.
Comments are closed