Networker

Re: [Networker] Does any one have some UNIX scripts that can calculate dates in the future? Summary

2004-03-31 12:39:33
Subject: Re: [Networker] Does any one have some UNIX scripts that can calculate dates in the future? Summary
From: Ed Skolnik <eskolnik AT INTERPUBLIC DOT COM>
To: NETWORKER AT LISTMAIL.TEMPLE DOT EDU
Date: Wed, 31 Mar 2004 11:36:14 -0600
I am sorry I posted this last e-mail, the real problem now is nsrmm is giving 
me a NON-ZERO return code when it  actually is
working. Sometimes I wish I back in the mainframe MVS where return codes were 
standardized.  I'll talk with Legato support to see if
it's coding bug or not.
 
!/usr/bin/ksh
_source_retention=/tmp/$(basename $0)_source_retention
_error_file=/tmp/$(basename $0)_errorfile
if [ -e ${_error_file} ]; then
    rm ${_error_file}
fi
if [ -e ${_source_retention} ]; then
   :
 else
    for client in ig00psbs ig00psd1 ig00psd2 ig00psdb; do
    mminfo -a -q"client=$client,level=full" -r'ssid,sscreate,ssretent,client,l
evel,name'  -ot
    done > ${_source_retention}
fi
 
cat ${_source_retention} | grep -v ssid | while read -r \
       ssid sscreate junk ; do
       echo " nsrmm -S $ssid -e \"$sscreate + 365 days \"   $junk"
       nsrmm -S $ssid -e "$sscreate + 365 days"
       if [ $? -ne 0 ]; then
          echo "Error Try 2"
          sleep 2
          nsrmm -S $ssid -e "$sscreate + 365 days"
           if [ $? -ne 0 ]; then
              echo "Error Try 3"
             sleep 60
              nsrmm -S $ssid -e "$sscreate + 365 days"
               if [ $? -ne 0 ]; then
                  sleep 3
                  echo "Error Try 4"
                  nsrmm -S $ssid -e "$sscreate + 365 days"
                  if [ $? -ne 0 ]; then
                    echo "$ssid $sscreate $junk Failed "
                    echo "$ssid $sscreate $junk Failed " >> ${_error_file}
                  fi
               fi
            fi
       fi
       done
 

-----Original Message-----
From: Ed Skolnik [mailto:eskolnik AT interpublic DOT com] 
Sent: Wednesday, March 31, 2004 11:04 AM
To: 'Legato NetWorker discussion'
Subject: RE: Does any one have some UNIX scripts that can calculate dates in 
the future? Summary


I want to thank all that replied to this question, It's great finding out the 
nsr_getdate works with nsrmm. 
 
The problem I am having now is when I run the command manualy it works, but 
fails when it's executed as part of a korn shell script.
 
 
nsrmm -S 1002073857 -e "02/24/04 + 365 days"     ------works manualy 
 
But from the script I get:
 
nsrmm -S $ssid -e \"$sscreate + 365 days\"    --actual command in scipt
 
nsrmm -S 1002073857 -e "02/24/04 + 365 days"
nsrmm: -S and volume names are mutually exclusive
usage: nsrmm [-v | -q] [-s server] [-f device]
  or   nsrmm -l [-v | -q] [-s server] [-f device] [-myB]
                [-e forever] [-c capacity] [-b pool] [-R | volume]
  or   nsrmm {-u | -j} [-v | -q] [-s server] [-y] [-f device | volume...]
  or   nsrmm -p [-v | -q] [-s server] [-f device]
  or   nsrmm -m [-v | -q] [-s server] [-f device] [-r] [volume]
  or   nsrmm {-d | -o mode} [-v | -q] [-s server] [-Py]
                [-S ssid[/cloneid] | -V volid | volume...]
  or   nsrmm [-s server] -S ssid {-w browsetime | -e retentiontime}
+ [ 1 -ne 0 ]
 

-----Original Message-----
From: Ed Skolnik Sent: Tuesday, March 30, 2004 3:41 PM
To: 'Legato NetWorker discussion'
Subject: Does any one have some UNIX scripts that can calculate dates in the 
future? 


Does any one have some UNIX scripts that can calculate dates in the future?  

For example In want to change the retention of some savesets to be  the "save 
set's completion time" plus 1 year.

 

Mminfo -q'client=something,level=full' -r'ssid,sscomp'  | while read ssid 
sscomp; do

 

   ~~~~~~~~~ calc new date `~~~~~~~~

nsrmm -S $ssid -e ${newdate}

done

 

 

 

Ed 

Any views or opinions presented in this email are solely those of the author 
and do not necessarily represent those of the company.
Also this message may  contain information which may be confidential and 
privileged. Unless you are the intended recipient (or
authorized to receive this message for the intended recipient), you may not 
use, copy, disseminate or disclose to anyone the message
or any information contained in the message. If you have received the message 
in error, please advise the sender by reply e-mail,
and delete the message.  Thank you very much. 

 

 


--
Note: To sign off this list, send a "signoff networker" command via email
to listserv AT listmail.temple DOT edu or visit the list's Web site at
http://listmail.temple.edu/archives/networker.html where you can
also view and post messages to the list.
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=