Operating System - HP-UX
1833777 Members
2279 Online
110063 Solutions
New Discussion

Re: favourite sysadmin scripts you always keep around....

 
SOLVED
Go to solution

Re: favourite sysadmin scripts you always keep around....

Hi Bill,

Although i am using this forum a lot, this is my first time to join...

Everytime i need to create FS and LVs, we need to check first the free space of our VGs right? That's why i created this script. This give me an idea how much is the free space on each VGs. Hope this help :)

script start here
--->
#!/usr/bin/ksh
#
#
VG_LIST=/tmp/vg_list.$$

vgdisplay | grep "/dev" | awk '{print $3}' > $VG_LIST

for i in `cat $VG_LIST`
do
VG_ALLOC=`vgdisplay $i|awk -v var=$i '/PE Size/ {PES=$NF} /Total PE/ {TPE=$NF} END{print "ALLOCATED SPACE for",var,vg=PES*TPE,"Mb"}'`
echo "$VG_ALLOC\c"
VG_USED=`vgdisplay $i|awk -v var1=$i '/PE Size/ {PES=$NF} /Alloc PE/ {APE=$NF} END{ print "\tUSED SPACE ",vg=APE*PES,"Mb"}'`
echo "$VG_USED\c"
VG_FREE=`vgdisplay $i|awk -v var=$i '/PE Size/ {PES=$NF} /Free PE/ {FPE=$NF} END{ print "\tFREE SPACE ",vg=FPE*PES,"Mb"}'`
echo "$VG_FREE"
done


exit 0

sample output
--->

ALLOCATED SPACE for /dev/vg00 34712 Mb USED SPACE 28472 Mb FREE SPACE 6240 Mb
ALLOCATED SPACE for /dev/appl 20568 Mb USED SPACE 18672 Mb FREE SPACE 1896 Mb
Asif Sharif
Honored Contributor

Re: favourite sysadmin scripts you always keep around....

This is cool script for cstm peripherial.

#!/usr/bin/sh

set -u

if [ $# -lt 1 ]
then
echo "Usage: $0 hardware_item"
echo " example: $0 disk"
echo " example: $0 processor"
echo " example: $0 memory"
exit
fi

if [ -f /usr/sbin/cstm ]
then
echo "selclass type $1;info;wait;infolog" | /usr/sbin/cstm
else
echo "/usr/sbin/cstm not installed."
fi


Regards,

Asif Sharif
Regards,
Asif Sharif
Etienne Roseau
Frequent Advisor

Re: favourite sysadmin scripts you always keep around....

hi everybody !!
small script about processes from users hard disconnection
E.
paolo barila
Valued Contributor

Re: favourite sysadmin scripts you always keep around....

Hi,
just a "ksh" debugged revision of a previous script

#!/bin/ksh

# select fields in a file for any purpose

FILE=/etc/hosts
let LENGTH=`wc -l $FILE|awk '{ print $1 }'`
let COUNTER=1

while (( COUNTER <= LENGTH ))
do
LINE=`head -$COUNTER $FILE|tail -1`
FIELD1=`echo $LINE|awk '{ print $1 }'`
FIELD2=`echo $LINE|awk '{ print $2 }'`
# etc.....

# test
print "$FIELD2 \t $FIELD1"

COUNTER=`echo "$COUNTER + 1"|bc`
done
share share share
Bill McNAMARA_1
Honored Contributor

Re: favourite sysadmin scripts you always keep around....

opened another thread..
It works for me (tm)