Networker

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

2004-03-30 16:51:23
Subject: Re: [Networker] Does any one have some UNIX scripts that can calculate dates in the future?
From: Tim Mooney <mooney AT DOGBERT.CC.NDSU.NODAK DOT EDU>
To: NETWORKER AT LISTMAIL.TEMPLE DOT EDU
Date: Tue, 30 Mar 2004 15:51:20 -0600
In regard to: [Networker] Does any one have some UNIX scripts that can...:

>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.

Get GNU `date' and use that in a shell script.  Or use perl's multitude of
time and date modules to do the same thing.

The "plus 1 year" turns out to be pretty darn easy, in this case:

        mon_num=`date +%m`
        day_num=`date +%d`
        curr_year=`date +%Y`
        next_year=`expr "$curr_year" + 1`
        year_date="$mon_num/$day_num/$next_year"

Re-order the string if you're using NetWorker in a locale that uses a
different convention.

Tim


--
Tim Mooney                              mooney AT dogbert.cc.ndsu.NoDak DOT edu
Information Technology Services         (701) 231-1076 (Voice)
Room 242-J6, IACC Building              (701) 231-8541 (Fax)
North Dakota State University, Fargo, ND 58105-5164

--
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.
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=