Monday, September 28, 2009

Ubuntu fonts

Get a raft of fonts for Ubuntu with a simple apt-get
sudo apt-get install ttf-sil-gentium ttf-dustin ttf-georgewilliams ttf-sjfonts sun-java6-fonts ttf-larabie-deco ttf-larabie-straight ttf-larabie-uncommon
Any, if Microsoft fonts are required:
sudo apt-get install msttcorefonts
Works a treat.. and you could do worse than gnome-specimen for a font previewer.

Monday, September 14, 2009

Load alert

I've been having an issue with a server whose load sporadically runs high. While trying to work out what the problem was, I needed a way to know when the load peaked.

I modified a simple script to allow me to do just that and then ran it from cron. Only problem is that if it detects a high load, an email is sent each time the cron is run (maybe every 5 minutes!)
avg=`uptime | awk '{print $8" " $9 " "$10 $11 $12 }' | tr -s , " "`
cur=`uptime | awk '{print $10}' | tr -d , | cut -d. -f1`
info="Curent $avg"
if [ $cur -ge 1 ]; then
info1="Server load is high presently"
touch /tmp/tmp.00
echo -e "$str\n$info\n$info1\n$str\n" >> /tmp/tmp.00
ps aux | head -1 >> /tmp/tmp.00
ps aux | sort -rn +2 | head -10 >> /tmp/tmp.00;
mail -s "Alert: Load Average for `hostname` on `date` " < /tmp/tmp.00;
rm -f /tmp/tmp.00
#echo -e "$str\n$info\n$str"
Cron might look something like this:
*/5 * * * * /usr/local/bin/loadaverage