ADSM-L

Re: Redirecting Output In Scripts

2001-07-03 10:26:43
Subject: Re: Redirecting Output In Scripts
From: "Sheets, Jerald" <JSHeets AT OLOLRMC DOT COM>
Date: Tue, 3 Jul 2001 08:42:32 -0500
Yeah, ADSM has some little idiosyncrasies that are hard to get used to.

Most often, I'm working out the selects from shell scripts as so:

REPORT="~/adsm.report"
ID="foo"
PW="bar"


and later:

BU_DATE=`dsmadmc -id=$ID -pa=$PW "select node_name,filespace_name from
filespace
s  where cast((current_timestamp-backup_end) days as decimal)> 2 and
(filespace_
type like 'ext2' or filespace_type like 'JFS')" | tail +13 |sed
'/ANS8002I/d' |s
ed '/^$/d' |awk {'print $1,$2'}`


and finally:

echo "Filespaces needing backup (>2 days without backup)" >$REPORT  # To
create file if neccessary
echo "                                            " >>$REPORT       # to
append file
echo "$BU_DATE                                    " >>$REPORT       # to
append file



        You may note that this script is comprised of two answers I got from
"old-timers" right here on this list (if you've been following at all).  It
selects a group of nodes whose "backup end" date is greater than two days
ago.  Next, it strips the IBM header and the results footer.  (a hack, I
know, but it works)  THe only place this is somewhat fishy is in reporting
NTFS or FAT filesystems.  As soon as the shell sees "\\", it freaks out.  I
fought with various escape sequences for days until I figured out I could
just kill the declaration early in the file, and put the whole output in one
place like so:

echo "                   Win32                    " >>$REPORT
dsmadmc -id=$ID -pa=$PW "select node_name,filespace_name from filespaces
where
cast((current_timestamp-backup_end) days as decimal)> 2 and (filespace_type
like
 'NTFS' or filespace_type like 'FAT' or filespace_type like 'API:NTEXC')" |
tail
 +13 |sed '/ANS8002I/d' >>$REPORT
echo "                  NetWare                   " >>$REPORT
dsmadmc -id=$ID -pa=$PW "select node_name,filespace_name from filespaces
where
cast((current_timestamp-backup_end) days as decimal)> 2 and (filespace_type
like
 'NTW:LONG' or filespace_type like 'NDS')" | tail +13 |sed '/ANS8002I/d'
>>$REPO
RT

That gives you the Win and Netware filesystems respectively.  I'm sending
reports to the UNIX, NT, and ORACLE teams by conditioning against FS type.


Hope that helps!

Jerald Sheets, Systems Analyst TIS
Our Lady of the Lake Regional Medical Center
5000 Hennessy Blvd, Baton Rouge, LA 70808
Ph.225.765.8734..Fax.225.765.8784
E-mail: jsheets AT ololrmc DOT com



<Prev in Thread] Current Thread [Next in Thread>