- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- script writing
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2001 09:19 AM
06-29-2001 09:19 AM
script writing
I have created a variable that holds all the rdsk names on the box, but now I need to execute the diskinfo command. My problem is my variable contains more then one drive and my diskinfo command will only run one character device at a time. What do i need to do to get the system to read my variable and run the diskinfo command to give me the info I need. Help, fairly new to script writing
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2001 09:30 AM
06-29-2001 09:30 AM
Re: script writing
I don't think diskinfo is what you really want to be using but here's how to do it:
DISKS="/dev/rdsk/c0t6d0 /dev/rdsk/c1t6d0"
for DISK in ${DISKS}
do
diskinfo -v ${DISK}
done
A better way (or actually several) to monitor
disk usage can be found in this thread:
http://forums.itrc.hp.com/cm/QuestionAnswer/1,1150,0xcae0f9beca68d511abcd0090277a778c,00.html
Regards, Clay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2001 09:31 AM
06-29-2001 09:31 AM
Re: script writing
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2001 09:38 AM
06-29-2001 09:38 AM
Re: script writing
Try this:
#!/usr/bin/sh
DIR=/dev/rdsk
for D in `ls $DIR`
do
diskinfo $DIR/$D
done
...or...
#!/usr/bin/sh
DIR="c0t6d0 c1t1d0 c1t1d1"
for D in $DIR
do
diskinfo "dev/rdsk/$D"
done
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2001 10:15 AM
06-29-2001 10:15 AM
Re: script writing
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2001 10:25 AM
06-29-2001 10:25 AM
Re: script writing
You need to look at the output from things like 'ioscan', 'pvdisplay' and 'vgdisplay'.
Based on what you are trying to assemble, a quick, free summary can be seen in the manifest file from Ignite.
I hope you are making Ignite recovery tapes of your systems (using 'make_tape_recovery') . If you are, everytime you do, you get a "free" configuration report, including a very nice summary of your LVM configuration. Look at:
/var/opt/ignite/recovery/latest/manifest
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2001 10:37 AM
06-29-2001 10:37 AM
Re: script writing
#!/usr/bin/sh
##
bdf | grep -iv filesystem | awk '{print $6 " "$5}' | while
read LINE; do
PERC=`echo $LINE | cut -d "%" -f1 | awk '{ print $2 }'`
if [[ $PERC -gt 90 ]]; then
echo "${PERC}% ALERT!" | mailx -s "${LINE} on `hostname` is almost full" root
fi
done
exit
This will send an e-mail to root. Or if you a complete report on LVM, disks etc, then try the script that is attached. I believe it was written by an HP engineer. I think someone in the forums sent it to me, anyway, it is very complete, I run it on a monthly basis. Hope this helps.
Rob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2001 03:04 PM
06-29-2001 03:04 PM
Re: script writing
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2001 09:11 PM
06-29-2001 09:11 PM
Re: script writing
Hi
I have a script here, That I am writng here, which will ask a vg name then U will have to type the VG name. Then it will list the diskinfo of all PVs in that VG.
echo "Enter the VG"
read vg
vgdisplay -v /dev/$vg | grep /dev/dsk | awk '{print$3}' > file1
sed 's/dsk/rdsk/' file1 > file2
>file3
while grep /dev file2 > /dev/null
do
diskinfo `cat file2 | line` >> file3
cat file2 | grep -v `line` > file2
done
cat file3
Please check up this will do or not.
Best of luck
Shahul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2001 02:14 PM
06-30-2001 02:14 PM
Re: script writing
This is a script I use,
Author was Adreas Voss.
I called it space check and cronned it to run twice a day.
It was posted by Andreas some time ago and does the job very well.
HTH
Paula
----------------------CUT HERE-------------------------
#!/sbin/sh
# Check server diskspace
# check with bdf filesystems on multiple servers
# Ensure server is in /etc/hosts file
# (c) hpux@voss2000.de 2000-10-11
# this script can/should be run with non root user
# for remote shell there has to be set permission in $HOME/.rhosts
# at the remote system(s)
# the script uses /tmp/bdfcheck directory to store percentage of
# each filesystem for history to avoid multiple message generation
MAILUSER="root;fred@company.com " # <-- put here the email address for sending
HOSTLIST="N-0 k1 k2" #
[ ! -d /tmp/bdfcheck ] && mkdir /tmp/bdfcheck
for host in $HOSTLIST
do
{
if [ $host = $(hostname) ]
then
bdf -t hfs -t vxfs -l
else
remsh $host bdf -t hfs -t vxfs -l
fi
}|tail +2 |awk -vhost=$host '{
if(length(fs)>1)
fs=fs $0;
else
{
if(NF == 1)
{
fs=$1;
continue;
}
else
fs=$0
}
printf("%-10s: %s\n",host,fs);
fs="";
}'
done |
awk -vmax=$HIGHWATERMARK -vdate="`date`" 'BEGIN{first=1}
{
percent=$7;
hostname=$1;
filesystem=$NF;
gsub("/","_",filesystem);
sub("%","",percent);
percent=sprintf( "%d",percent);
histfile="/tmp/bdfcheck/" hostname filesystem;
getline oldpercent
print percent >histfile;
line=$0;
if(percent > oldpercent && percent > max)
{
if(first==1)
{
printf("%s\n\nFilesystems with more than %d%% usage:\n \n",date,max);
printf("%-10s Filesystem kbytes used avail %%used Mounted on\n","Hostname");
first=0;
}
printf("%s\n",line);
}
}' >/tmp/bdf_$$
if [ -s /tmp/bdf_$$ ]
then
cat /tmp/bdf_$$ | mailx -s 'FILESYSTEMS WARNING' $MAILUSER
fi
rm -f /tmp/bdf_$$
cd /tmp/bdfcheck
rm *
-------------------------cut here -------------------