Archive for June, 2006

MacSaber 1.1: Attack of the Backlight

Thursday, June 22nd, 2006

MacSaber 1.1 has been released, now with expanded 17″ PowerBook support and keyboard backlight effects. I invite you to take your very expensive laptop into a dark room and swing it around* for improved dramatic effect.

Download MacSaber 1.1.

*Don’t break your laptop, okay? If you do, don’t blame me.

Preventing an OSX Log File Meltdown

Monday, June 19th, 2006

Over the past few weeks, my MacBook Pro has been running slower and hotter with constant harddrive activity. Just this afternoon, iStat Nano measured my CPU at 170ËšFahrenheit, well beyond normal operating range.

I know that claims of hot MacBooks have become quite passe, but my laptop was literally hot enough on the bottom to burn me. At idle, CPU load averaged at around 1.50 and the harddrive was constantly writing according to the activity monitor. I brought this situation to the Apple forums and promptly recieved the answer.

Apparently Apple overlooked several logfiles when they set up the log rotation scripts in /etc/weekly. The texfile /var/log/samba/log.nmbd had topped 100 million lines in a month. The file measured 6.8GB before I removed it.

The Samba logs are two out of a handful of logfiles that are not rotated:

/var/log/samba/*
/var/log/crashreporter.log
/var/log/install.log
/var/log/cups/* (access_log is self-rotated by cupsd)

There are several breakdown scenarios which could lead to massive record dumping into some of these files. Unfortunately, there comes a point where adding more lines to a poorly trimmed log file is like throwing water on a grease fire.

If your OSX Mac is exhibiting any of the symptoms mentioned above or you want to ensure optimal health for your system, you will likely benefit from this script.

1) Open the local weekly script file

sudo nano /etc/weekly.local

Note: You will be asked for your system password.

2) Paste the following script in the file

printf %s "Rotating extra log files:"
cd /var/log
for i in crashreporter.log install.log samba/log.nmbd samba/log.smbd; do
if [ -f "${i}" ]; then
printf %s " $i"
if [ -x /usr/bin/gzip ]; then gzext=".gz"; else 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 mv -f "${i}" "${i}.0" && if [ -x /usr/bin/gzip ]; then gzip -9 "${i}.0"; fi; fi
touch "${i}" && chmod 640 "${i}" && chown root:admin "${i}"
fi
done
if [ -f /var/run/smbd.pid ]; then kill -HUP $(cat /var/run/smbd.pid | head -1); fi
if [ -f /var/run/nmbd.pid ]; then kill -HUP $(cat /var/run/nmbd.pid | head -1); fi
echo ""

After you’ve pasted this script, press Ctrl+X then press Y.

3) Make the file executable

sudo chmod 755 /etc/weekly.local

4) Try out your fancy new log rotation script

sudo sh /etc/weekly.local

You won’t need to manually run this script after this one time, but once you have, you may find your system runs much smoother and cooler.

Thanks to Apple forums member “iggle” for their help in diagnosing this problem.