Perl Tricks

In my environment there are some commands I need to run as “true root”, which means I have to login to the server as root… no su or sesu. We have all of our Unix/Linux servers locked down for root access via SSH, so every now and then I need to open root temporarily in order to login as root to run some commands. I got tired of manually editing sshd_config and restarting the service just to re-do every change I just made. Here is a couple of Perl one-liners that will do the job for me.

Linux, Perl Scripts Read More

Verify reboot and oracle process with Perl Script

Here is a script I wrote that I will run in cron on the days that we have autosys reboot schedules. The script will check if the server has been rebooted in the last 2 hours and if it’s rebooted in the last 24 hours. It also checks to see if Oracle processes are running. In the case that either the reboot failed or the Oracle processes did restart or aren’t running it will send an e-mail notification to whoever is specified in the @to array variable.

Linux, Perl Scripts, Tutorials/Whitepapers Read More

Multiple host ping sweep Perl script

I was tasked with verify host connectivity after some server patches were pushed out.  So instead of manually pinging each one, and I already had a text file with all the affected hostnames, I decided to put together a little script that would read from the text file and print out whether the host was up or down. 

I have simplified my original multiple host ping sweep script. All you need for this script to work is a hosts.txt file with a list of host names or IP addresses and of course the script below.

Linux, Network Security, Perl Scripts, Tutorials/Whitepapers, Windows Read More