0% found this document useful (0 votes)
74 views4 pages

AIX Admin Shell Script Guide

This script collects volume group and physical volume information on an AIX system and stores it in a file for reporting purposes. It loops through each volume group, collecting details about the drives and logical volumes, then does the same for each physical volume. The script provides a way to gather and report on storage configuration information for troubleshooting or planning purposes.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
74 views4 pages

AIX Admin Shell Script Guide

This script collects volume group and physical volume information on an AIX system and stores it in a file for reporting purposes. It loops through each volume group, collecting details about the drives and logical volumes, then does the same for each physical volume. The script provides a way to gather and report on storage configuration information for troubleshooting or planning purposes.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Suresh Kumar Pakalapati's Linux Administration: AIX Shell Scripts Page 1 of 4

MONDAY, DECEMBER 19, 2011 ABOUT ME

AIX Shell Scripts

GETTING VG AND PV INFORMATION Suresh Kumar Pakalapati


THIS SCRIPT COLLECTS VOLUME GROUP AND PHYSICAL VOLUME INFORMATION AND COLLECTS THEM IN A Hi This is Suresh Kumar
FILE Pakalapati . I am a person who is
THIS INFORMATION IS IMOPORTANT AS ONE SCRIPT ON A SERVER WILL PROVIDE ALL THE INFORMATION positive about every aspect of life.
ABOUT ALL THE VG AND PV UNDER IT There are many things I like to do,
to see, and to experience. I like to
for x in $(lsvg) ;SELECT ALL THE VOLUME GROUPS feel the music flowing on my face,
I like good books and romantic,
do
action,cartoon movies. I like the
echo "************************************" >> /tmp/[Link] ;PUT A START MARKER land and the nature, And, I like to
keep smile on my face. I always
echo VG INFORMATION FOR $x >> /tmp/[Link] wanted to be a great and
successful person in the world
lsvg -p $x >> /tmp/[Link] ;COLLECT INFO ABOUT DRIVES and I know it is needed More and
More education, More work,
lsvg -l $x >> /tmp/[Link] ;COLLECT INFO ABOUT LV
Success Never come in a short
lsvg $x >> /tmp/[Link] ;COLLECT DETAIL INFO ABOUT VG
Time.....
echo "************************************" >> /tmp/[Link] View my complete profile

done
HISTATS
for x in $(lspv|awk ‘{print $1}’) ;SELECT ALL PHYSICAL VOLUME

do

echo"************************************" >> /tmp/[Link]

lspv $x >> /tmp/[Link] ;STORE THE PV INFORMATION

lspv –l $x >> /tmp/[Link]


SEARCH THIS BLOG
echo"************************************" >> /tmp/[Link] Search

done
PAGE VISITORS MAP
TO CUT REQUIRED LOG FROM A LARGE LOG FILE
Recent Visitors
In the script “mm” “dd” “yy” is month date and year respectively , this
script is useful if a logfile has large content of everyday logs and we have
to fetch log of a specific date for a specific host or string

for x in hostname1 hostname2 hostname3 ... CATEGORIES

do 3D (2) Acl (3) ActiveDirectory (1)

Admin(309) AIX (90)


cat |awk '/"mm"\/"dd"\/"yy""/,/END/'|awk /"$x"/,/"
Amanda(2) Android(7) Antivirus (1)

done Apache(55) BackupRecovery


(20) Bible(1) BigData(2) BootProcess
TAKING VIO BACKUP TO A REMOTE FILESYSTEM (15) Bugzilla (1) C (4) CentOS(6)
Cheat Sheet(1) Chrome(2) Cisco(4) Citrix
HN=`hostname`
(1) CloudComputing (9) Cluster
LOGFILE="/home/padmin/[Link]" (12) Commands (68) Compress
(1) Cron(10)Cvs (2) DBA (2) Dhcp
EMAILADDR=xyz@[Link] (9)Dns (29) Downloads (1) DRBD
(1)Drupal(1) EMC (1) Endeca(2) Ethereal
echo "GATHERING VIOS CONFIGURATION" > $LOGFILE
(1) Facebook (3) FileSystem (6)
/home/padmin/[Link] >> $LOGFILE 2>&1 Firewall (1) FreeNAS(2) Ftp (5) Gadgets
(2) Git (1) GLPI(2)Gmail(5) Gmail voice
date >> $LOGFILE 2>&1 calling(1)Google (17) Google+ (4)
GoogleChrome (3) Grep(1)GRUB (7)

[Link] 9/27/2013
Suresh Kumar Pakalapati's Linux Administration: AIX Shell Scripts Page 2 of 4

/usr/ios/cli/ioscli mount :/ / >> $LOGFILE 2>&1 Gtalk(1) Hacking(71) Hadoop(1)


Heartbeat (5) Help(1)History(1) HP-UX
/usr/ios/cli/ioscli backupios -file //${HN}_mksysb -mksysb >> $LOGFILE 2>&1 (2) Htaccess (6) ILO (3) IncomeTax
(8) inittab(1) Installations (1)
if [[ $? -ne 0 ]]
InterviewQuestions (43)
then iPhone(2) IPtables (31) iSCSI(2) ITIL
(1)Jboss(3) Jesus(1) Joomla(1) Kerberos
mail -s "ERROR CREATING VIOS BACKUP" $EMAILADDR < (1) Kernel(14) Kickstart (5) LAMP
(1)Ldap (13) Linux(19) Logrotate (1)
vio bachup for $HN has failed ! Please look into log /home/padmin/[Link] !
Logs(2)LTSP (2) Lun (1) Lvm (25) Mac

EOF (1) MailServer (11) Monitoring (31)


Mozilla(1) Mysql(27) Nagios(8) Nas (2)
fi Networking (16) New (1) Nfs (14)
Nginx(2) Nis (9) Ntp (1) Openfiler (1)
/usr/ios/cli/ioscli unmount / >> $LOGFILE 2>&1
OpenNebula (5) OpenSource (3)
COLLECT ALL THE INFORMATION OF A CHILD DEVICE COMING FROM A FC ADAPTER OpenVPN(2) Oracle(5) Orkut(2) Outlook
(3) PAM (7) Permissions (1) Phones-
Tablets (23) Php (3) PortNumbers (1)
Postfix(1) Postgresql (7) Proc(5)Project
lsdev -l $1
Management(1) Proxy(1) Puppet(1) Putty
echo "PARENT DEVICE FOR ** $1 ***"
(2) Pxe (3) QuestionsAnswers (3)
lsdev -l $1 -F parent
Quota(1) Raid(8)Recovery (9)
a=$(lsdev -l $1 -F parent)
RedHat(5) Rhce(26)RHEL 5(5)
echo "PARENT DEVICE FOR ** $a ** IS" RHEL 6(8) Rhel6(3) RootKit(5) Rpm
lsdev -l $(lsdev -l $1 -F parent) -F parent (4) Rsync(7) Samba(19) Samsung(1)
b=$(lsdev -l $(lsdev -l $1 -F parent) -F parent) San (4) Scheduling (1) Screen(1)
echo "ALL THE CHILD DEVICES CONNECTED TO DEVICE ** $a **" Scripting (23) Security (55)
lsdev -p $(lsdev -l $1 -F parent) Selinux(6) SendMail (5) Services (1)
echo "ALL THE CHILD DEVICES CONNECTED TO DEVICE ** $b **" ShellScript (4) Snmp(2)Solaris(7)
lsdev -p $(lsdev -l $(lsdev -l $1 -F parent) -F parent) SPAM(1)Squid(9) Ssh (18) Sshfs(1)
fc=$(echo $b|grep -e fcs0 -e fcs1 -e fcs2 -e fcs4 -e fcs5) Ssl (7) Steve Jobs(1) Sudo(3)Svn (9)
ck=${#fc} Swap(4)Syslogd(1) Tcp/Ip(2)
if [ $ck -eq 0 ] TeamViewer (1) Technology (8) Tftp
then (1)ThinClient (2) TimePass (10)
echo "BACKUP ADAPTER IS NOT FC" TipsTricks (3) Tomcat(10) Tools(5)
exit Torrents (1) TripWire (2) TroubleShoot
else (4) Ubuntu(30) ulteo(1) UNIX
echo "PLEASE WAIT WHILE COLLECTING FC COMMUNICATION" (4)Useful(99) UserAdministration
for x in $fc (4) Veritas Cluster(2) Vi (3) VirtualBox
do (7)Virtualization (22) Virus(1)
c=5 VMware(21) Vnc (2) Vpn (3) WebMin
echo "DATA TRANSFER FOR ** $x ** " (1) WebServers (1) WikiLeaks (2)
while [ $c -gt 0 ] Windows(28) Windows7 (1) Wireshark
do (1) WordPress (1) Xen (4) Yahoo(1)
fcstat $x|awk '/Transmit/,/Words/' YouTube(2) Yum (5)
sleep 10
c=$(($c-1))
BLOG ARCHIVE
done
done ► 2010 (397)
fi ▼ 2011 (911)
► January (2)
► March (4)
COLLECTING MICROCODE INFORMATION
► May (34)
###### THIS SCRIPT COLLECTS INFORMATION ########### ► June (70)
############# AND HOST LISTS ARE IN FILE [Link]########### ► July (117)

exportfs –i /suptools ► August (280)


► September (276)
for x in $(cat /home/aixadmin/[Link])
do ► October (21)
echo $x >> /suptools/[Link] ► November (44)
ssh $x ls -lasd /suptools
▼ December (63)
if [ $? == 0 ]
then ► Dec 01(1)
ssh $x mount -o rw :/suptools /suptools ► Dec 06(2)
echo "************************************************8" >> /suptools/[Link]
► Dec 11(43)
ssh $x /suptools/./coldata >> /suptools/[Link]
ssh $x umount /suptools ► Dec 13(4)
echo "************************************************8" >> /suptools/[Link] ► Dec 15(1)
else
► Dec 16(4)
ssh $x mkdir /suptools
ssh $x mount -o rw :/suptools /suptools ▼ Dec 19(5)
echo "************************************************8" >> /suptools/[Link]
ssh $x /suptools/./coldata >> /suptools/[Link]

[Link] 9/27/2013
Suresh Kumar Pakalapati's Linux Administration: AIX Shell Scripts Page 3 of 4

ssh $x umount /suptools AIX SAMBA


echo "************************************************8" >> /suptools/[Link] CONFIGURATION -
BASIC SETUP
fi
done AIX PAGING SPACE
CREATING AIX
CONTENTS OF coldata
MKSYSB ISO
BOOTABLE IMAGE
hostname >> /suptools/[Link]
oslevel -s >> /suptools/[Link] QUICK REFERENCE
lsmcode -r >> /suptools/[Link] FOR LDAP
for dv in $(lsdev -Cc adapter|awk '{print $1}'|grep -e ent -e fcs -e sisscsi) CONFIGURATION IN
AIX
do
echo $dv >> /suptools/[Link] AIX Shell Scripts
lsmcode -r -d $dv >> /suptools/[Link]
► Dec 20(3)
done
#
► 2012 (267)
CREATING A USER ► 2013 (13)
#############################################################
############ THIS WILL ASK UID AND USER NAME ################# SUBSCRIBE TO
############AND WILL CREATE USER NAME ON THE SERVERS #############
Posts
##### LISTED IN THE FILE "xyz" ########
Comments
echo enter user-id followed by user name for eg 30 username
read uid usd
#echo enter password to reset for the user $usd HOLY BIBLE VERSE DAILY
for x in $(cat xyz)
do

echo creating user $usd on host $x


ssh $x mkuser id=$uid $usd
done
exportfs -i /exportfilesystem
echo enter password to reset for the user $usd
read pas
echo "echo $usd:$pas|chpasswd" > /exportfilesystem/[Link]
chmod +x /exportfilesystem/[Link]
for x in $(cat xyz) MY FOLLOWERS
do
ssh $x mkdir /exportfilesystem
ssh $x mount current_server:/exportfilesystem /exportfilesystem
ssh $x /exportfilesystem/[Link]
ssh $x umount /exportfilesystem
done

RESETTING A USER LOCKED PASSWD

echo enter user name to reset


read usd
echo this will reset user $usd locked password
chsec -f /etc/security/lastlog -a "unsuccessful_login_count=0" -s $usd
chuser "account_locked=false" $usdFINDS OUT FILE SYSTEM UTILIZATION
THIS SCRIPT FINDS AND TELLS YOU WHICH FILE SYSTEM ARE UTILIZING SPACE BOVE THAN
THRESHOLD SET BY YOU INDIBLOGGER

h=$(hostname)

df -gt |grep -v Filesystem|grep -v proc|while read out

do

fs=$(echo $out|awk '{print $5 }'|cut -f1 -d%)

MY QR CODE
if [ "$fs" -gt 90 ]; then

echo "***********************************"

echo FILE SYSTEM LARGER THAN 90% ON $h ARE

echo $out

echo "***********************************"

fi

done

[Link] 9/27/2013
Suresh Kumar Pakalapati's Linux Administration: AIX Shell Scripts Page 4 of 4

GETTING PORT ADDRESS FOR SERVICES


THIS SCRIPT CALCULATES AND SHOWS WHICH PORT IS USED BY WHICH SERVICE ,VERY
IMPORTANT SCRIPT FOR ALL AIX ADMINISTRATORS

for x in $(netstat -Aan|grep LISTEN|awk '{print $1}')

do

a=$(netstat -Aan|grep LISTEN|grep $x|awk '{print $5}'|cut -f2 -d .)

b=$(rmsock $x tcpcb|awk '{print $9}')

echo PORT $a is used by

ps -ef |grep $b

done

SCRIPT 1 – FINDING USER’S PASSORD EXPIRE DATE


############################################################################

# THIS SCRIPT WILL ASK A USER NAME AND TELL WHEN ITS PASSWORD WILL EXPIRE

#I HAD NOT MADE IT VERY SMOOTH BUT STILL IT SOLVES A VERY BIG THING

################################################################################

echo enter user name ; PROVIDE THE USER NAME

read uame

lstup=$(pwdadm -q $uame|grep -e lastupdate|cut -f2 -d=)

echo LAST PASSWORD UPDATED FOR USER $uame ON >> /tmp/[Link]

echo $lstup| perl -e 'print localtime(<>) . "\n";' >> /tmp/[Link]

mxag=$(lsuser -a maxage $uame|cut -f2 -d=)

pwexp=$(expr 604800 \* $mxag)

pwexp=$(($lstup + $pwexp))

echo PASSWORD EXPIRE DATE FOR USER $uame >> /tmp/[Link]

echo $pwexp| perl -e 'print localtime(<>) . "\n";' >> /tmp/[Link]

cat /tmp/[Link] ;THE OUTPUT IS STORED IN [Link] FILE

echo $usd:test@1234|chpasspw

Posted bySuresh Kumar Pakalapati at4:41 PM Recommend this on Google

Labels:AIX,ShellScript
Reactions:

Links to this post


Create a Link

Newer Post Home Older Post

Picture Window template. Powered by Blogger.

[Link] 9/27/2013

You might also like