Scripts

These scripts are presented as both tools for various tasks as well as sample code for cannibalistic purposes.

All scripts are released as public domain. No license or guarantee is associated with this code.


odate

   
Description: This is a Perl script designed to mimic the Unix date command but optionally present the date with an offset (such as a week ago, or a week from now).
Notable items: This script contains Perl POSIX time code that was related to a paper on the subject of Unix time that I am working on, as well as a special flag for the AIX errpt command to get all events in the last hour/day/week etc...
Platform: I have run this on AIX, Linux, OS X, and Solaris with no issues.
Source: odate
Top

fsdelta

   
Description: This is a find wrapper that can be used to find the total size of all files in a directory that were changed in the last day. The intent was to create a tool that could be used prior to a backup implementation to tell the rate of change in a filesystem.
Notable items: This script includes code that "factors" bytes to Kilo, Mega, and Gigabytes. It also skirts the issue of filenames with spaces in them by using the -ls option to find.
Platform: I have run this on AIX, Linux, OS X, and Solaris with minimal issues. Portability concerns are addressed in comments as the top of the script.
Source: fsdelta
Top

profile

   
Description: This is my default AIX profile (starting point).
Notable items: This profile contains some escape characters that may be illegible in some editors. Furthermore it makes assumptions about your terminal or preferences that may not be appropriate. This should only be used as a starting point.
Platform: I currently only use this on AIX.
Source: profile
Top

cs

   
Description: This is a script that includes ASCII color manipulation functions. The use of the functions are demonstrated in the script.
Notable items: The functions are useful if they are cannibalized into other scripts. The script here has no value otherwise it just displays several lines of text with various colors.
Platform: Written on Linux, run successfully in the OS X terminal application. This will not work in a shell that does not support the -n option to echo (fixing this is a simple port).
Source: cs
Top

getpvid

   
Description: A script to read the PVID off of an AIX PV.
Notable items: The first (and only) parameter must be the full path to a hdisk device. The script will dd (read) the section of the device where it expects a pvid to exist, and display that on the screen. I have used this script (and a C binary version) to tell if the PVID on the disk agrees with what the ODM has (as shown by lspv). (This can be a problem with cluster disks, or disks that have changed without notifying the OS.)
Platform: AIX only (Unless you have imported an AIX PV into another OS).
Source: getpvid
Top

pingwatch

   
Description: A short script to watch a list of hosts for up/down status.
Notable items: The script will look for a file called hostlist in the current directory that is a list of hosts to ping. It iterates through the list and will attempt to ping each IP address / host in the list.
Platform: I have used this on Linux and OS X
Source: pingwatch
Top

roothome

   
Description: A script to change root's home directory to /root (from /).
Notable items: [When arguing religion, it is necessary to be thorough. So pardon the verbiage.] It is my opinion that the Linux concept of putting the root user in a specific home is a good idea. It allows the option to enforce security and hide any files that may belong exclusively to root. Granted, this should not be a common occurrence as you should not be logging in as root but having the ability is better than not having the ability. Plus it tends to keep the / directory "cleaner". It is also important to note that the home for root must be on the same root filesystem (and NOT /home/root).
Platform: AIX only
Source: roothome
Top