Friday, January 5, 2018

Linux: Script to test IPs

Friday, January 05, 2018 0 Comments
So today I was sitting free, and the sysadmin gave me a list of IPs to ping. Being the lazy person I am, I decided to look online for ready-made scripts to ping IPs and list out the results pingable (UP) unpingable (DOWN)

The first search result had a lot of samples to work with and I picked the best:

Of course the sysadmin helped me tweak the script:

Bear in mind that an IP is not pingable, it may take several seconds before the script moves on to the next IP, so the script in general may time some time to run and output its results, so if you are testing a 100 IPs, just pipe the results to a file on the system and run the job in the background so you can check the results when you are free later.

I am not cruel, here is the script for you to copy paste it and run on your Linux (tested on RHEL)

#! /bin/bash

for ip in XXX.XXX.XXX.{XXX..XXX}; do  # for loop and the {} operator
    ping -c 1 $ip > /dev/null 2> /dev/null  # ping and discard output
    if [ $? -eq 0 ]; then  # check the exit code
        echo "${ip} is up" # display the output
        # you could send this to a log file by using the >>pinglog.txt redirect
        echo "${ip} is down"

Thursday, October 26, 2017

Friday, August 18, 2017

Linux: Mimipenguin and How to Find Users Passwords on CentOS

Friday, August 18, 2017 1 Comments
So here I was scrolling my Google + and came across this fantastic review about this nifty little tool called mimipenguin

I just had to download it and test it out on my CentOS

Of course, I only had a single user other than root on my VM so for testing purposes, I added a few dummy users with passwords

And followed the steps from techmint to download and install the software

Then I ran the script, it takes a while to output results on the screen, and if you have more than 100 users on the system except your system to hang, yes you read me correctly. 

I would suggest you to put the script on cron and run at a time when the server is free (middle of the night, wee hours of the morning- you get the picture) even better get a few hours downtime just to run the script on a heavy prod server (make sure all your apps aren't running)


Out of 5 user I have on the system, it only detected one user and its password
Did not detect root user and its password

Well, I leave the rest for you to use and judge

I installed git on my CentOS first

Then I copied the software directory into root dir

Created some dummy users with password on the system

Ran the shell script on the machine and I get the same just detects user priti and no one else

And I can't run the Python script on my host, I get this error

I know, I know I am missing something here, so I did a little bit of digging and found that the script is looking for python3 and I only have python installed (version 2.7.5)

And then located where my python runs from (the usual /usr/bin) and ran the python script as such

And the script is still running, I expect it to run longer than the shell script or probably hang. I got tired of waiting so I just halted the script

The results are the same, I can only get the user and password for user priti

Monday, August 14, 2017

Food Review: Oat Chocolate Chip Cookies No egg No butter

Monday, August 14, 2017 0 Comments
Feeling depressed and dejected that my job applications are being rejected, and my follow up emails are bring ignored, and my Linkedin messages are not being replied to, I decided to seek some comfort, in some comfort food of course!!!

Come hither, these babies tasted so darn good

I hacked the recipe from here

Of course I made a few adjustments to what I have sitting in my pantry

It tasted good and I was happy

I added chopped up white chocolate while the cookies were cooling down. I just pressed down the chucks into the cookies; which added more craggies to it and made it look even better

Couldn't help myself nibbling into one cookie, damn hoe was beckoning to be eaten (sorry the language)

And here's my version of the recipe

My hacks:

bourbon flavored vanilla essence

granulated sugar instead of brown sugar

sunflower oil instead of coconut oil

2 cups of instant Quaker oats

Friday, August 11, 2017

UNIX : Changing swap value on HP-UX and AIX

Friday, August 11, 2017 0 Comments
I don't like messing with a prod server's swap value unless there is a direct request from a customer

Here's how you do it on HP-UX and AIX. I trust you have your CR raised


The default value for swappiness is 60. You can alter it temporarily (until you next reboot) by typing as root

echo 50 > /proc/sys/vm/swappiness

If you want to alter the swap value change permanently then you need to change the vm.swappiness parameter in the /etc/sysctl.conf file

Step 1: check what is the current value for swap

sudo cat /proc/sys/vm/swappiness

(It should give a number 60 here)

Step 2: change to a lower number

sudo sysctl -w vm.swappiness=5

Step 3: check again

sudo cat /proc/sys/vm/swappiness

(Now, it should give a number 5 here)

Step 4: append the line vm.swappiness=5 in file /etc/sysctl.conf using vi editor


Things are easier on AIX with the use of smitty. I used AIX version 5.3

1. Check the current paging and swapspace value

# lsps -a

# pstat -s

2. Run smitty and make changes on the fly

# smit pgsp-----to increase/decrease paging

3. Check paging and swapspace value again

# lsps -a

# pstat -s

4. To add paging space

# smit lvm---paging space---add


#smit mkps

UNIX: Solving Stale PP Error after VIO2 shutdown in AIX

Friday, August 11, 2017 0 Comments
I had a customer that had 2 VIOs setup for their LPARs. When VIO2 was shutdown/powered back on, as expected the rootvg on the server showed "stale partition" or "stale PP" error

To remediate this problem the rootvg on client server needs to be varyon, but then we also have a second problem where the sysdump is holding onto the rootvg; thus disabling us to perform varyon

So in order to do a VG varyon, we need to release rootvg from the clutches of sysdump

I trust you have raised a CR for this task

1. The first step is to make note of the sysdump location

@stepper:/# sysdumpdev
primary              /dev/lg_dumplv
secondary            /dev/lg_dumplvII
copy directory       /var/adm/ras
forced copy flag     TRUE
always allow dump    TRUE
dump compression     ON

2.  Change the sysdumpdev to a temporary "null" device

@stepper:/# sysdumpdev -p /dev/sysdumpnull
primary              /dev/sysdumpnull
secondary            /dev/lg_dumplvII
copy directory       /var/adm/ras
forced copy flag     TRUE
always allow dump    TRUE

dump compression     ON

@stepper:/#  sysdumpdev -s /dev/sysdumpnull
primary              /dev/sysdumpnull
secondary            /dev/sysdumpnull
copy directory       /var/adm/ras
forced copy flag     TRUE
always allow dump    TRUE

dump compression     ON

3. Perform the varyon

# varyonvg rootvg

4.  Sync rootvg

# syncvg -v rootvg

(NOTE: will probably give error "Unable to synchronize logical volume")

5. Check the vg and make sure all PV are active

# lsvg -p rootvg

6. Set the sysdumpdev back to their original values (from step 1)

# sysdumpdev -p /dev/hd7

# sysdumpdev -s /dev/hd71

7. Check that everything is ok now

# lsvg rootvg