The Purple Cow: sysadmin central

As a professional geek and system administrator, I've written a lot of quaint little programs to help me along the way. And now I am sharing them to the world. They are simple scripts, and hopefully you'll find them useful. Most should work for most any Unix OS (BSD, Solaris, SunOS, Linux).

Enjoy!

--peter



Shell Scripts
name shell description
codez perl Command-line web scraping tool which allows you to quickly search for information on area codes, phone numbers, zip codes, and even get all the zip codes for a given city. Only good for US zip codes and phone numbers. Uses USPS.com and MelissaData.com.
syslogmailer sh This shell script sends a given user a day's output of the syslog. Originally written for Solaris, it will probably work most anywhere.
mlogmailer ksh Based on syslogmailer, mails out a defined set of logs to a user for the previous day. Finds problems before you realize them.
adduser ksh Uses Solaris' useradd program to add users. Makes adding users fun!
fw-1-pager ksh Takes input from a CheckPoint FireWall FW-1 formatted accept/deny message, formats it does error checking, then pages, mails, or logs the accept/deny. Used mostly for denies, so the sysadmin is paged or e-mailed where the deny was from. Useful if the box is comprimised and logs are modified.
check_load ksh Using uptime, awk, top, and mail, this script checks the load on the box, and based on a scale, either pages or mails the specified people.

C Programs
  • wtmpxcut.c
  • wtmpxcut binary for Solaris 2.6
  • C program When I saw that /var/adm was being taken over by a 9MB wtmpx file, I looked for a wtmpx trimmer. I found this. I took it, translated it from French to english, made it more friendly by adding command line options, intuitive error messages, some buffer overflow precautions, and tested it on two Solaris platforms. I like it.