syslog consuming 100% cpu - SOLVED!
A couple of months ago, I dropped my MacBook and the hard drive froze. I was able to replace it with no issue. I went to install Leopard, but the DVD couldn't be read. So, I reinstalled Tiger and opened a support case...bottom line, when I dropped the laptop, the DVD can't read double density DVDs anymore.
Why is this significant? It's not, but part of the story.
When I took my laptop in because I couldn't get Leopard installed, the store installed via an external drive. The result from this upgrade was that the /etc/periodic/daily/500.daily was renamed /etc/periodic/daily/500.daily.applesaved and the original file was replaced with a new version.
When the periodic daily job was run, both files ran. The problem is that the 500.daily.applesaved file is for some reason not compatible. The line in the backed up file that was causing the problem was:
syslog -p -k Time lt -7d -o -k Time lt -3d -k Level ge 4 -o -k Time lt -1d -k Level ge 6
Don't know why it caused the problem, but it did. The full content of the file that was backed up follows. Once I removed the .applesaved file, it worked like a champ.
#!/bin/sh -
#
# @(#)daily 8.2 (Berkeley) 1/25/94
#
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin
host=`hostname -s`
bak=/var/backups
echo "step 1"
echo "Removing scratch and junk files:"
if [ -d /var/rwho ] ; then
cd /var/rwho && {
find . ! -name . -mtime +7 -exec rm -f -- {} \; ; }
fi
# Clean up junk files.
#find / \( ! -fstype local -o -fstype rdonly \) -a -prune -o \
# \( -name '[#,]*' -o -name '.#*' -o -name a.out -o -name '*.core' \
# -o -name '*.CKP' -o -name '.emacs_[0-9]*' \) \
# -a -atime +3 -exec rm -f -- {} \;
# Clean up NFS turds. May be useful on NFS servers.
#if [ "${host}" != "localhost" ]; then
# find / -name .nfs\* -mtime +7 -exec rm -f -- {} \; -o -fstype nfs -prune
#fi
if [ -d /tmp ]; then
cd /tmp && {
find . -fstype local -type f -atime +3 -ctime +3 -exec rm -f -- {} \;
find -d . -fstype local ! -name . -type d -mtime +1 -exec rmdir -- {} \; \
>/dev/null 2>&1; }
fi
if [ -d /var/spool/fax ]; then
echo "step 2"
echo "Removing scratch fax files"
cd /var/spool/fax && \
find . -type f -name '[0-9]*.[0-9][0-9][0-9]' -mtime +7 -delete >/dev/null 2>&1;
fi
# remove system messages older than 21 days
msgs -c
if [ -f /var/account/acct ] ; then
if [ -x /usr/bin/gzip ]; then gzext=".gz"; else gzext=""; fi
echo "step 3"
echo "Gathering accounting statistics:"
cd /var/account
if [ -f "acct.2${gzext}" ] ; then mv -f "acct.2${gzext}" "acct.3${gzext}" ; fi
if [ -f "acct.1${gzext}" ] ; then mv -f "acct.1${gzext}" "acct.2${gzext}" ; fi
if [ -f "acct.0${gzext}" ] ; then mv -f "acct.0${gzext}" "acct.1${gzext}" ; fi
cp -pf acct acct.0
if [ -x /usr/bin/gzip ]; then gzip -9 acct.0; fi
sa -s > /dev/null
fi
#if [ -d /var/db/netinfo ]; then
# echo ""
# echo "Backing up NetInfo data"
# cd /var/db/netinfo
# for domain in *.nidb; do
# domain=$(basename $domain .nidb)
# server=`nicl -t localhost/$domain -statistics | grep tag | awk '{print $3}'`
# if [ $server = master ] ; then nidump -r / -t localhost/$domain > $bak/$domain.nidump; fi
# done
#fi
echo "step 4"
echo "Checking subsystem status:"
echo ""
echo "disks:"
df -k -l
echo ""
dump W
if [ -d /var/spool/mqueue ]; then
echo "step 5"
echo "mail:"
mailq
fi
echo "step 6"
echo "network:"
netstat -i
echo "step 7"
if [ -d /var/rwho ] ; then
ruptime
fi
echo "step 8"
printf %s "Rotating log files:"
cd /var/log
for i in system.log; do
if [ -f "${i}" ]; then
printf %s " ${i}"
if [ -x /usr/bin/gzip ]; then gzext=".gz"; else gzext=""; fi
if [ -f "${i}.6${gzext}" ]; then mv -f "${i}.6${gzext}" "${i}.7${gzext}"; fi
if [ -f "${i}.5${gzext}" ]; then mv -f "${i}.5${gzext}" "${i}.6${gzext}"; fi
if [ -f "${i}.4${gzext}" ]; then mv -f "${i}.4${gzext}" "${i}.5${gzext}"; fi
if [ -f "${i}.3${gzext}" ]; then mv -f "${i}.3${gzext}" "${i}.4${gzext}"; fi
if [ -f "${i}.2${gzext}" ]; then mv -f "${i}.2${gzext}" "${i}.3${gzext}"; fi
if [ -f "${i}.1${gzext}" ]; then mv -f "${i}.1${gzext}" "${i}.2${gzext}"; fi
if [ -f "${i}.0${gzext}" ]; then mv -f "${i}.0${gzext}" "${i}.1${gzext}"; fi
if [ -f "${i}" ]; then
touch "${i}.$$" && chmod 640 "${i}.$$" && chown root:admin "${i}.$$"
mv -f "${i}" "${i}.0" && mv "${i}.$$" "${i}" && if [ -x /usr/bin/gzip ]; then
gzip -9 "${i}.0"; fi
fi
fi
done
if [ -f /var/run/syslog.pid ]; then kill -HUP $(cat /var/run/syslog.pid | head -1); fi
echo "done rotating"
# Prune the main syslog output file (/var/log/asl.log)
# Delete all messages after 7 days (-k Time lt -7d)
# Delete Warning (Level 4) and above after 3 days (-k Time lt -3d -k Level ge 4)
# Delete Info (Level 6) and above after 1 day (-k Time lt -1d -k Level ge 6)
echo "step 9"
syslog -p -k Time lt -7d -o -k Time lt -3d -k Level ge 4 -o -k Time lt -1d -k Level ge 6
echo "step 10"
if [ -f /etc/daily.local ]; then
echo "step 11"
echo "Running daily.local:"
sh /etc/daily.local
fi
if [ -f /etc/security ]; then
echo "step 12"
echo "Running security:"
sh /etc/security 2>&1 | sendmail root
fi
Labels: Annoyances, Apple, Computers, Hardware, Mac OS X, MacBook
