Bekijk de volledige versie : Prevent crond from logging (WL-500gP with Oleg's fw)
richard_roe
18-10-2007, 13:40
Hi!
I've got no harddisk attached and since I run a script every minute issued by crond using the command: crond -c /usr/local/cron -b -l 0 , i notice that /tmp/syslog.log i growing bigger and bigger.
Every time crond runs a script I get a line in the syslog like this:
Oct 18 13:30:01 crond[27658]: USER root pid 29894 cmd /usr/local/sbin/run-parts /usr/local/cron/cron.1mins
Do you have a ny suggestions how I can avoid that? I wouldn't like to have any info at all regarding cron jobs in my syslog. The loglevel flag doesn't seem to be implemented in my crond :(
Regards Richard
If your issue is that the log file gets too big, then have a
look at the ipkg package 'syslog-ng' and 'logrotate'
http://www.nslu2-linux.org/wiki/Optware/Syslog-ng
richard_roe
20-10-2007, 15:56
If your issue is that the log file gets too big, then have a
look at the ipkg package 'syslog-ng' and 'logrotate'
http://www.nslu2-linux.org/wiki/Optware/Syslog-ng
Thanks avberk!
That might be a solution for me. Yes, the log file get's to big but only for one reason and that's the frequent logging of the crond jobs. Otherwise there are very few entries in the log. I will consider your suggestion if I can't find a way to make crond be less noisy. Thanks! :D
Meanwhile I've put this ugly script in work (another cron job).
It's ugly but it seems to do it's job!
#!/bin/sh
cat /tmp/syslog.log | grep -v crond | tail -n 100 > /tmp/syslog.tmp
chmod 600 /tmp/syslog.tmp
rm -f /tmp/syslog.log
mv /tmp/syslog.tmp /tmp/syslog.log
richard_roe
27-10-2007, 09:52
I thought I found a solution and made a syslogd.conf file where I just told syslogd to put all crond messages into /dev/null
However it became clear to me that the BusyBox version of syslogd that we are using doesn't care about syslogd.conf
These matters are extremely important when trying to keep a SPIN-DOWN able hard disk to remain spinned down. However I haven't connected any hard disk yet but I'm planning to buy another WL500GP and attach a HD to it. One option is of couse to simply kill the syslogd process. The syslog.log is only good if someone cares to read it.
I can suggest the straightforward solution:
restart syslogd with lower loglevel. Default is 7 which means the highest possible details. To use loglevel 6 is enough to eliminate these boring messages...
Here is my /opt/etc/init.d/S01syslogd. It kills default process, moves the log which already recorded to /opt/var/log and starts new syslogd instance.
#!/bin/sh
#
# Startup script for syslog
#
PATH=/opt/bin:/opt/sbin:/opt/local/bin:/sbin:/bin:/usr/bin:/usr/sbin
NAME=syslogd
DAEMON=/sbin/$NAME
LOGFILE=syslog.log
KERNLOGFILE=kern.log
LOG_OLD=/tmp
LOG_NEW=/opt/var/log
# Copy old syslog and create symlink to new
if [ ! -L $LOG_OLD/$LOGFILE ]; then
cat $LOG_OLD/$LOGFILE >> $LOG_NEW/$LOGFILE
mv $LOG_OLD/$LOGFILE $LOG_NEW/$KERNLOGFILE
ln -s $LOG_NEW/$LOGFILE $LOG_OLD/$LOGFILE
fi
[ -n "`pidof $NAME`" ] && killall $NAME 2> /dev/null
$DAEMON -m 0 -O "$LOG_NEW/$LOGFILE" -S -l 6 -s 0
logger -t $NAME "restarted."