Disable logging of _some_ cron jobs (repost)

Disable logging of _some_ cron jobs (repost)

Post by Martin Vonwal » Thu, 15 Nov 2001 21:01:24



Hi all!

I have one cron job which has to run every other minute as root user. Cron
now creates a logentry every time this script is executed - which (in this
case) is unnecessary and it completely trashes my logfile.
The log entry in /var/log/messages looks like
-----
Nov 14 12:46:00 Heraklith /USR/SBIN/CRON[18763]: (root) CMD (
/usr/scripts/checkinternet >/dev/null 2>&1)
-----
Well - 95% of my logfile look like this :-(

My crontab looks like:
-----
SHELL=/bin/sh
PATH=/usr/bin:/usr/sbin:/sbin:/bin:/usr/lib/news/bin
MAILTO=root
.....
*/2  * * * *    root  /usr/scripts/checkinternet >/dev/null 2>&1
......
-----

Is there any possibility to prevent cron to log the execution of this (and
only this) script?

Thanks in advance for any tip,
Martin

P.S: To prevent some confusion like the last time I posted this: I want to
prevent logging the _execution_ of this script - I dont care about the
_output_ of this script!

 
 
 

Disable logging of _some_ cron jobs (repost)

Post by Donald Arsenea » Fri, 16 Nov 2001 09:53:16



> I have one cron job which has to run every other minute as root user. Cron
> now creates a logentry every time this script is executed - which (in this
> case) is unnecessary and it completely trashes my logfile.
> The log entry in /var/log/messages looks like
> -----
> Nov 14 12:46:00 Heraklith /USR/SBIN/CRON[18763]: (root) CMD (
> /usr/scripts/checkinternet >/dev/null 2>&1)
> -----
> Well - 95% of my logfile look like this :-(

> Is there any possibility to prevent cron to log the execution of this (and
> only this) script?

It isn't cron that is logging, but the system logger.  I don't
think it is practical to shut off logging for particular jobs.
(Like everything else, it is probably *possible*...)

Might you be better served by a continuously resident job that
goes to sleep for a minute every cycle?

When you look at the logs you could filter them with grep
to remove all the lines containing "checkinternet".



 
 
 

Disable logging of _some_ cron jobs (repost)

Post by Martin Vonwal » Fri, 16 Nov 2001 15:45:11


Quote:> Might you be better served by a continuously resident job that
> goes to sleep for a minute every cycle?

No, it _might_ not be better; it _is_ better ;-)))
I changed it now in that way.

Quote:> When you look at the logs you could filter them with grep
> to remove all the lines containing "checkinternet".

But nonetheless the log looked like grep... ehm... *- and that was
disturbing me.

Thanks for your reply,
Martin