Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

placing korn shell variables in a separate file 1

Status
Not open for further replies.

icu812

MIS
Sep 10, 2001
52
0
0
US
I have a script that checks file system growth and works fine. I want to put the variables in the script in a seperate file though so that Operations can add and delete the File Systems we monitor from the script. Anyone got any suggestions on how I would go about accomplishing this?

#! /usr/bin/ksh
/etc/profile
. /.profile
EXCLUDE1=spfcw
EXCLUDE2=pdb
EXCLUDE3=f5
EXCLUDE4=f6
EXCLUDE5=f7
EXCLUDE6=sp34cw:/dev/dbfs1
EXCLUDE7=sp22cw:/dev/u04
EXCLUDE8=sp22cw:/dev/u05
EXCLUDE9=sp22cw:/dev/u08
/usr/lpp/ssp/bin/dsh df -k|grep /dev|grep 9[7-9]%|grep -v "$EXCLUDE1"|grep -v "$
EXCLUDE2"|grep -v "$EXCLUDE3"|grep -v "$EXCLUDE4"|grep -v "$EXCLUDE5"|grep -v "$
EXCLUDE6"|grep -v "$EXCLUDE7"|grep -v "$EXCLUDE8"|grep -v "$EXCLUDE9" >> /tmp/fs
file.txt
if [ -s /tmp/fsfile.txt ]
then
mail -s &quot;SP Filesystems Over 95% Full&quot; mickey_r_mouse@disney.com < /tmp/fsfile.
txt
fi
 
There are lots of ways to do this... You might try posting this in the Unix Scripting forum - those guys love this kind of problem ;-) But I'll try a suggestion.

It looks like you want to list file systems to exclude in your variables? How about something like this:

/usr/lpp/ssp/bin/dsh df -k|grep /dev|grep 9[7-9]% > /tmp/fsfile_1
for FS in `cat excluded_files`
do
grep -v $FS /tmp/fsfile_1 > /tmp/fsfile
cp /tmp/fsfile /tmp/fsfile_1
done
...

In this case, your list of excluded file systems (excluded_files) would just be a list like:

spfcw
pdb
f5
f6
f7
...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top