William's Projects

Not shown here are William's major, proprietary projects and those developed for previous employers. After all, we wouldn't want to violate any copyright laws, nondisclosure contracts, or opportunities to monetize particularly novel solutions!

Linux (Probably Unix-Compatible) Projects

As the network administrator of a sizable home office (5 servers, 5 workstations, Cisco routing, LinkSys wireless, 3 subnets), you sometimes find that you create tools that just might be generally useful, as in, by other people. William shares his efforts here in the spirit of Free Open Source. Please remember to give credit to William if you use or redistribute any of this material!

William's collection of generally useful bash shell scripts:

hgSync.sh
A Mercurial (hg) Source Code Control simplification script. Despite the intentions of its creators, maintainers, and fan-boys, Mercurial just isn't especially easy to use. This is not merely a personal opinion. Rather, I have worked on professional teams in very large multinational organizations who also experienced occasional frustration with Mercurial on the Linux or Mac command-line. Teaching newcomers to use Mercurial is always an exercise in answering the same few questions several times before Mercurial's work-flow finally "sinks in". hgSync.sh is based largely on input from others along with my own interpretation of the theme, "Mercurial would be so much easier to use if we didn't have to memorize so many of its commands -- and the magic order in which to run them, which changes depending on the situation -- in order to complete what should be daily, trivial operations!" The solution offered here wholly manages local and remote repository synchronization (including cloning and initializing new repositories -- and properly handling the esoteric subrepositories system -- whenever needed) with a single command and is comprised of two files:
  1. hgSync.sh, the main script file, and
  2. hgSettings.sh, a set-once-and-forget-it configuration script (that you are required to edit and keep in the same directory as hgSync.sh before using hgSync.sh).
Self documented (just execute hgSync.sh --help), this shell script (for use with bash) is extremely easy to use and has proven itself reliable for over a year and a half of near daily use. Enjoy!
P.S.: This script is for use only with SSH configurations and you are very strongly urged to use password-less (via Agent Forwarding, SSH Keys, etc.) connections because a lot of commands are executed in rapid succession!
ZZbackup.cron
There are about as many solutions for automated nightly server backups as there are people running servers. This is just one more. William took this opportunity to learn Linux shell scripting on RHEL4/CentOS4. He bought a book (ISBN: 0- 596-00595-4) and cranked this solution out after reading the first hundred, or so, pages in just two days. The result is an automation script which archives your system critical files to an off-host share, while preserving the integrity of those files by stopping and restarting system services that may have those files open. William used to run very primitive interdependent shell scripts to do this work in the past (which did little more than copy files to alternative directories, then compress the result) and he decided to levy his professional programming experience to the task in order to produce a more dynamic solution. There are two files involved:
  1. The ZZbackup script file which should live in /etc/cron.daily/. This beastly script file is fed by user preferences (edit within the head of the source) and the following external list file.
  2. The backup file and directory list which should live in /etc/ (as /etc/backuplist and not /etc/backuplist.txt). This is the bottle that feeds the ZZbackup script. Whatever file and directory names you put in this file will get backed up. This is a sample file. You must tailor this file to your own specific needs for this solution to provide maximum benefit to you.
service-control.sh
This script compliments ZZbackup.cron and (as of version 1.3) is mentioned in the documentation for the RUN_*_BACKUP options. If you have services that are not hooked by /sbin/service (i.e.: you have to manually configure them to start at boot by editing your /etc/rc.d/rc.local file), or you don't have /sbin/service (Debian users) take a look at this sample script. The version here illustrates how you might use it for enabling service-like control over my popAuth3 or Frank Denis' pure-ftpd. Save this script file as /usr/local/sbin/service-control. Note that the presense of this file does not negate the need to keep those entries in your rc.local file, although you could change those entries to call this script instead of the deamons directly.