Shell Scripting
Shell scripts for all types of task automation.
Quickly show memory usage under AIX
5Very quick and basic shell script to show total/free/used memory on a host running AIX.
kristijan@AIX > ./meminfo Memory Information ================== total memory = 1884 MB free memory = 94 MB used memory = 1790 MB
Automount AFP shares in OSX
0So I’ve finally got around to building my NAS. It’s a pretty 12TB FreeNAS using RAIDZ…she runs very nicely
At first, I was using SMB, but found the performance from AFP better, that’s for another post though. For the life of me, I couldn’t find the “Mac” way of auto mounting an AFP share. So being the sysadmin ninja that I am, I just went along and did it my own way.
Luckily for us, the pretty OSX frontend sits on top of a UNIX backend. In short, I ended up using autofs, and it works rather well. Below is how to get it working.
(more…)
Keeping an eye on TSM volumes
1I wrote a quick script which tells me when volumes in TSM (Tivoli Storage Manager) have access and/or media issues and shoots me off an email. The script does two things:
1) Checks for volumes which are NOT in the states READWRITE or OFFSITE.
2) Checks for volumes which have a read/write error count >0.
I’m sure that most people running TSM in their environment have some sort of daily reporting that gets sent out. If that’s the case, you can simply extract the SQL from the script and use it in your own reporting tools.
(more…)
Calculate total usage in AIX volume group
2When looking at the output of the “lsvg” command in AIX, you’ll see a whole bunch of information regarding the volume group. The PP size, how many PPs are in the volume group, stale PVs, quorum, so on and so on. What I’m normally looking for when running the “lsvg” command is:
1. How much storage (PPs) do I have free.
2.How much storage (PPs) is in use.
3.How much storage (PPs) is actually being used.
I can get the first two questions answered looking at the output of “lsvg”, but the last one I cannot.
(more…)
Maintain wtmp on AIX
3/var/adm/wtmp on AIX maintains a list of past user sessions and information about the restart/shutdown of that particular system. While this file is normally very small in terms of file size, on an active box, this can grow if not properly maintained. You can use the “last” command to read wtmp, or export it to a text file for further processing with “fwtmp”. While you can simply redirect nothing into wtmp to empty it out “>/var/adm/wtmp”, it’s always a good idea to keep this file (or at least a backup) for security/auditing reasons.
(more…)