UnixPedia : HPUX / LINUX / SOLARIS: HPUX : SIMPLE SCRIPT TO GET IMPORTANT INFO FROM SYSTEM TO COMPARE

Saturday, September 21, 2013

HPUX : SIMPLE SCRIPT TO GET IMPORTANT INFO FROM SYSTEM TO COMPARE

Below script need to executed before server reboot

Make a executable file :
#cat >Data_pre.sh
Loggin=`logname`
export  DIR=/home/$Loggin/ 
cd $DIR
mkdir $DIR/todayaction2;cd todayaction2;parstatus >parstatus.pre_output;setboot -v >setboot.pre_output; \
bdf >bdf.pre_output;vparstatus >vparstatus.pre_output; \
sysdef > sysdef.pre_output; \
vgdisplay  -v >vgdisplay.pre_output; \
tail /var/adm/syslog/syslog.log > syslog.pre_output; \
ioscan >ioscan.pre_output;netstat -in >netstat.pre_output; \
cmviewcl -v >cmviewcl.pre_output;lanscan >lanscan.pre_output; \
ps -ef |grep -i pmon >oracle.pre_output;netstat -rn >netrpre_outpute.pre_output; \
swapinfo -tam >swap.pre_output; \
ps -efx >Porcess.pre_output; \
mount  -v   >mount-v-pre_output ; mount  -p >mount-p-pre_output ; \
lvlnboot -v >lvlnboot.pre_output ;ps -ef |grep -i horc > horc.pre_output; \
showmount -e >showmount-e-pre_output ; showmount -a >showmount-a-pre_output; \
uptime >uptime-pre_output ; vgdisplay -v >vgdisplay_pre_output; \
cp -p /etc/lvmtab /etc/lvmtab.`logname`.`date +%d-%m-%Y`.pre_output

tar -cvf  /home/$Loggin/Data_collectoin_`uname -n`_Before.tar /home/$Loggin/todayaction2
c /home/$Loggin/Data_collectoin_`uname -n`_Before.tar Data_collectoin_`uname -n`_Before.tar | mailx -m -s " Data_collectoin_`uname -n`_Before.tar " $Loggin@its.jnj.com


Below script need to executed After server reboot

Make a executable file :
#cat >Data_Post.sh       

Loggin=`logname`
export DIR=/home/$Loggin/ 
cd $DIR
mkdir $DIR/todayaction2;cd todayaction2;parstatus >parstatus.post_output;setboot -v >setboot.post_output; \
sysdef > sysdef.post_output; \
bdf >bdf.post_output;vparstatus >vparstatus.post_output; \
vgdisplay  -v >vgdisplay. post_output; \
tail /var/adm/syslog/syslog.log > syslog.post_output; \
ioscan >ioscan.post_output;netstat -in >netstat.post_output; \
cmviewcl -v >cmviewcl.post_output;lanscan >lanscan.post_output; \
ps -ef |grep -i pmon >oracle.post_output;netstat -rn >netrpre_outpute.post_output; \
swapinfo -tam >swap.posst_output; \
ps -efx >Porcess.post_output; \
mount  -v   >mount-v-post_output ; mount  -p >mount-p-post_output ; \
lvlnboot -v >lvlnboot.post_output ;ps -ef |grep -i horc > horc.post_output; \
showmount -e >showmount-e-post_output ; showmount -a >showmount-a-post_output; \
uptime >uptime-post_output ; vgdisplay -v >vgdisplay_post_output; \
cp -p /etc/lvmtab /etc/lvmtab.`logname`.`date +%d-%m-%Y`.post_output
tar -cvf  /home/$Loggin/Data_collectoin_`uname -n`_After.tar /home/$Loggin/todayaction2

uuencode /home/$Loggin/Data_collectoin_`uname -n`_After.tar Data_collectoin_`uname –n`_After.tar | mailx -m -s " Data_collectoin_`uname -n`_After.tar " $Loggin@its.jnj.com

IMPORTANT NOTE : PLEASE HASH THOSE LINE WHICH MAY HUNG YOUR SCRIPT, IF ANYTHING WRONG WITH SYSTEM

No comments:

Post a Comment