Removing old kernel to free up /boot partition

Posted by Rianto Wahyudi

For those who allocate less than 100MB for /boot on RHEL6 .. beware !
The kernel that ships with RHEL6 is quite big and you'll run out of space after few patches.

To list  all old kernel while excluding  currently active kernel:

 rpm -qa | egrep kernel-'(2|3|PAE|dev)' | sort -n | grep -v `uname -r| sed 's/PAE//'` 

Then run the following to remove it :

 yum remove $(rpm -qa | egrep kernel-'(2|3|PAE|dev)' | sort -n | grep -v `uname -r| sed 's/PAE//'` )

Pingdom Update Contact for On Call Roster

Posted by Rianto Wahyudi

# Script to update contact details on pingdom
# Accept phone number as the first argument
# Pingdom will automatically add +61[mobile number] - so the zero '0' prefix in front of mobile number need to be stripped
# Valid input : 432123456
# No error checking on this script as 'we know what we are doing(tm)'

# Change Log:
# 20100809 (rwahyudi) - Create script
# 20100820 (rwahyudi) - Add simple check


if [ $# -lt 1 ]; then
echo "Usage: $0 [mobile number]"
echo " Pingdom will automatically add +61[mobile number] - so the zero '0' prefix in front of mobile number need to be stripped"
echo "Example: $0 432123456"
exit 1

# Remove Cookie and login
rm $DIR/cookie.txt
curl -x proxy.company.com:8080 -c $DIR/cookie.txt -d "username=$USERNAME&password=$PASSWD " https://pp.pingdom.com/index.php/login

# Edit OnCall contact
# OnCall ID = 12345
# See posting on how to get this value
curl -x proxy.company.com:8080 -b $DIR/cookie.txt -d "name=OnCall&email=OnCall%40company.com&country=15&phone=$1&twitter_dm=1&twitter_user=&defaultprovider=3&retryprovider=1&Submit=Update+Contact" https://pp.pingdom.com/index.php/member/contacts/edit/12345

# Check contact and email details on update to confirm that contact has been updated
PINGDOM_ACTIVE_NUMBER=$(curl -sq -b $DIR/cookie.txt https://pp.pingdom.com/index.php/member/contacts | grep -A1 " OnCall

"  | grep "+61-" | cut -d '-' -f2 | cut -d'<' -f1)
PINGDOM_ACTIVE_ONCALL=$(grep $PINGDOM_ACTIVE_NUMBER $DIR/phonelist.csv  | cut -d ',' -f1)

echo "

Pingdom active On-Call : $PINGDOM_ACTIVE_ONCALL

"| mail -s "$PINGDOM_ACTIVE_ONCALL ($CRT_ACTIVE_ONCALL) is now the active On-Call contact"  $MAIL

Bash script : DNS Check match between reverse and forward lookup

Posted by Rianto Wahyudi

Basic bash lookup script to check if forward / reverse IP address is matching.

  • The script use host command, it'll  automatically add DNS prefix based on /etc/resolv.conf
  • Support for hostnames  or PTR address with multiple RR
Usage: ./checkhost <IP or hostname> checkhost<IP or hostname> ...
Example: ./checkhost www pop3.iinet.net.au
This script will check if forward and reverse match

./checkhost shadow pop3.iinet.net.au
shadow <-> : Match
pop3.iinet.net.au <-> : Match
mud.starway.net.au <-> : Match

Download the script here :