Articles in SysAdmin
Obfuscating Passwords in Shell Scripts
At the risk of repeating myself, I must say that this article is about obfuscating passwords – rendering obscure, unclear, or unintelligible – not hiding them. This can still be useful.
Extracting Email Addresses from TCP Streams
Here’s a quick example of using tshark to extract email addresses from TCP streams. Let’s say some application on your server is sending emails and you want to find out who is receiving those emails. …
Occupy Subnet
The script below (tested on RHEL 7) will use arp-scan to identify unused IPs on your subnet and configure virtual interfaces attached to your primary NIC to take over every available IP.
Whiptail and Dialog Snippets
Whiptail is a newt-based utility allowing to build pseudo-graphical dialog boxes from shell scripts. Dialog uses ncurses and is similar to whiptail but has more options and, consequently, a bit harder to use. I find both useful …
Export WP Posts and Sync to Sharepoint
Long story short: old wiki is overloaded and broken; new wiki is not a wiki but SharePoint – a glorified file server; people are forced to improvise and put documentation on a WP wiki; bosses …
CLI System Monitoring Tools
The multitude of sophisticated centralized monitoring tools available these days excel at one thing: telling you what happened while you’ve been sleeping. But what if you’re awake and need to know what’s going on right …
Useful MySQL One-Liners
I am by no means an expert SQL programmer. Having said that, I’ve been using MySQL for a very long time. This is a collection of simple but useful SQL queries and MySQL configuration options. …
Checking Multiple Variables in Bash
Let’s say you have a dozen variables in your script and you need to check if they have values set. The usual approach can get a bit tedious.
Plotting Log Data
While I am on the subject of selecting time ranges from logs, a practical application presented itself. A lonely server in a far-away land with a habit of running out of memory could only be …
Croncal – the Cron Calendar
The croncal is a clever Perl script that reads entries in your crontab and outputs a schedule, showing the time when cron jobs will run.
Selecting Time Ranges from Logs
Consider a common situation: you would like to select lines from a log file that match a specific string, but only during a specific time frame. For example, my /var/log/messages contains entries from one of the …
Install and Configure Etckeeper
Etckeeper is a handy tool that uses git to keep track of changes to anything in /etc (or any other folder you choose). It’s very simple to use and can help you quickly identify and undo stupid …
Using IPTables to Allow Access to Private Networks
Below is a quick example of how to use iptables to allow port access for all types of private networks. In this case we’re allowing access to ports 10000 and 20000, commonly used by webmin and usermin.
Parallel Rsync
This is an update of the script I originally wrote five years ago and used to migrate many terabytes of production data between two NAS systems. What’s new: more efficient subfolder crawling, more effective way …
SystemD: Back To The Future
A creature in its death throes, Sun Microsystems gave birth to Solaris SMF – the product of a disturbing union between Unix System V and the Microsoft Windows Registry. Shortly thereafter the proud father died, …
Migrating Filesystems with Active Processes
I’ve run into an interesting challenge: I needed to migrate application data from a local filesystem to NFS without stopping the processes running in the original mountpoint. Here’s a basic overview of the process. This …
Get a List of all ESX Hosts in a Datacenter
Another simple one-liner to get a list of hostnames of all ESX servers in the vCenter. This can be useful for a number of things, specifically as input for other PowerCLI scripts.
Use PowerCLI to Change NIC Type
This is a quick PowerCLI script that reads from a list of VM names and for each VM with network adapter type “E1000” changes it to “Vmxnet3”. Nothing fancy, no reboot is needed. MAC should …
Pushing SSH Keys
This is just a quick note for me on pushing SSH keys using sshpass and xargs. The ~/hosts.txt file contains a list of remote hosts, one per line. And the ~/.passwd.txt contains your password. Make sure to chmod 400 …
Sample Salt Proxy Configuration for vCenter/ESX
The Salt proxy agent is a relatively new feature of Salt allowing to control networked devices where salt-minion cannot be installed directly. The official Salt documentation on the subject is outdated and full of syntax errors. It’s actually …
Configure and Run esxcli on Red Hat
The esxcli utility is used to interface with the vSphere and ESX hosts. It is a useful tool for getting to some basic VMWare functionality from Unix shell. It is also a pre-requisite for some of …
Wget Examples
This is a follow-up to my previous wget notes (1, 2, 3, 4). From time to time I find myself googling wget syntax even though I think I’ve used every option of this excellent utility over the …

Latest Comments