Networker

[Networker] Changing saveset directories on the fly

2008-03-04 18:05:49
Subject: [Networker] Changing saveset directories on the fly
From: mgolden <networker-forum AT BACKUPCENTRAL DOT COM>
To: NETWORKER AT LISTSERV.TEMPLE DOT EDU
Date: Tue, 4 Mar 2008 14:59:47 -0800
Okay, I ended up writing a script to create an nsradmin input file to change 
the save set directory daily before it runs.  The first half of it is a 
"determine yesterday's date" script I found online.  Why reinvent the wheel, 
right? :)  Here's the script&#058;


# Changes the saveset value in the client attributes for DVR_945 and DVR_946

# Determine yesterday's date stamp
set DAYS Sat Sun Mon Tue Wed Thu Fri Sat
set MONTHS Dec Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
YESTERDAY=$((`date +%d` -1))
MONTH=`date +%m`
YEAR=`date +%Y`
NDAY=`date +%u`
WEEKDAY=${DAYS[`date +%u`]}
if [ $YESTERDAY -eq "0" ]
then
        MONTH=$((MONTH-1))
        if [ $MONTH -eq "0" ]
        then
                MONTH=12
                YEAR=$((YEAR-1))
        fi
set `cal $MONTH $YEAR`
shift $(($# - 1))
YESTERDAY=$1
fi
TMONTH=${MONTHS[MONTH]}

if [ `expr length $MONTH` -eq 1 ]
then
MONTH="0$MONTH"
fi

if [ `expr length $YESTERDAY` -eq 1 ]
then
YESTERDAY="0$YESTERDAY"
fi

DATADIR="D:\\\\Data\\\\$YEAR$MONTH$YESTERDAY\\\\"

# Build nsradmin input file
echo ". type: nsr client; name: DVR_945" > /tmp/dvr.txt
echo "update save set: \"C:\", \"SYSTEM STATE:\", \"SYSTEM FILES:\", \"SYSTEM 
DB:\", \"ASR:\", \"$DATADIR\"
">>/tmp/dvr.txt

/usr/sbin/nsradmin -s phxlegat -i /tmp/dvr.txt

echo ". type: nsr client; name: DVR_946" >/tmp/dvr.txt
echo "update save set: \"C:\", \"SYSTEM STATE:\", \"SYSTEM FILES:\", \"SYSTEM 
DB:\", \"ASR:\", \"$DATADIR\"
">>/tmp/dvr.txt

/usr/sbin/nsradmin -s phxlegat -i /tmp/dvr.txt

rm -f /tmp/dvr.txt

+----------------------------------------------------------------------
|This was sent by mgolden AT kanbay DOT com via Backup Central.
|Forward SPAM to abuse AT backupcentral DOT com.
+----------------------------------------------------------------------

To sign off this list, send email to listserv AT listserv.temple DOT edu and 
type "signoff networker" in the body of the email. Please write to 
networker-request AT listserv.temple DOT edu if you have any problems with this 
list. You can access the archives at 
http://listserv.temple.edu/archives/networker.html or
via RSS at http://listserv.temple.edu/cgi-bin/wa?RSS&L=NETWORKER

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