I'm replying to 3 seperate suggestions to my cron problem:
1)
On Tuesday 24 January 2006 00:17, Ehud Karni wrote:
> Why don't you check all the processes with `ps -ef', or better still
> find the crond sid and do `ps -fs <crond-sid>'.
>
> Ehud.
Here's output of commands run at 18:20 - 20 minutes after the hourly cron
started:
[EMAIL PROTECTED] solomon]# ps -A j|grep crond
1 5843 5843 5843 ? -1 Ss 0 0:00 crond
[EMAIL PROTECTED] solomon]# ps -fs 5843
UID PID PPID C STIME TTY TIME CMD
root 5843 1 0 Jan22 ? 00:00:00 crond
root 16910 5843 0 18:01 ? 00:00:00 CROND
root 16914 16910 0 18:01 ? 00:00:00 /usr/sbin/sendmail
-FCronDaemon
root 16915 16914 0 18:01 ? 00:00:00 /usr/sbin/postdrop -r
To remind you, I get e-mails immediately from the 5 scripts in
the /etc/cron.hourly directory, but the e-mail that cron itself sends arrives
50 minutes later. It seems to me that the problem is with postfix. Am I
wrong?
2)
On Tuesday 24 January 2006 00:22, Imri Zvik wrote:
> Add the time command in front of the run-parts command, i.e.:
> 01 * * * * root nice -n 19 time run-parts /etc/cron.hourly
> The output will give you the total time it took to run run-parts
Here's the e-mail cron sends me 50 minutes late:
this script is /etc/cron.hourly/aaaa-test-hourly
**** this is a test of the echo command in a CRON job ****
this script is /etc/cron.hourly/hylafax
**** this is a test of the echo command in a CRON job ****
this script is /etc/cron.hourly/msec
**** this is a test of the echo command in a CRON job ****
this script is /etc/cron.hourly/sysstat
**** this is a test of the echo command in a CRON job ****
this script is /etc/cron.hourly/zz-myechotest
**** this is a test of the echo command in a CRON job ****
0.26user 0.05system 0:01.13elapsed 27%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+7430minor)pagefaults 0swaps
As you can see, run-parts is executing almost immediately.
3)
On Tuesday 24 January 2006 10:14, Maxim Kovgan wrote:
> Hi Shlomo.
> I think it is rather useless to use "mail" binary in the cronjobs,
> since cron uses it anyway.
> the only thing you really need to do is to write something onto the
> stdout from a cron job's script. namely, the date, and scripts name.
> add:
> echo "$0 started at `/bin/date`"
> to the start of the script, and:
> echo "$0 finished at `/bin/date`"
I agree, but I guess you didn't notice that added both to the end of each
script - the echo command AND the mail command. The reason was that, as I
wrote, the mail sent by CRON (including the output of the 5 echo commands - 1
for each script) is arriving 50 minutes late and I don't know why. By adding
an additional mail command to each script, I was able to prove that the
actual scripts are executing immediately - because the mail from MY mail
command arrives immediately. This seems to prove that the problem is with
cron or as others already suggested with run-parts.
> On 1/23/06, Shlomo Solomon <[EMAIL PROTECTED]> wrote:
> > ## first we test echo
> > echo " this script is " $0
> > echo "**** this is a test of the echo command in a CRON job ****"
> >
> > ## now mail to solomon
> > echo "hylafax-hourly is mailing to solomon" | mail -s "hylafax-hourly
> > solomon" solomon
> >
> > At 1 mnute past the hour, I get 5 e-mails (one from each of the above
> > jobs), but only at 51 minutes past the hour, I get an e-mail from cron
> > itself including the output of the 5 echo lines.
--
Shlomo Solomon
http://the-solomons.net
Sent by KMail (KDE 3.4.2) on LINUX Mandriva 2006
=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]