Many people I have talked with have a requirement to keep a month end backup for an extended period of time. This is where backupsets can be very helpful, but what do you do when backupsets just wont cut it? Well I have a requirement to keep some month end data for extended periods but all other backups are kept for 30 days. How do I accomplish this? The answer is a shell script. Before the ehanced scheduler came about in TSM 5.3 the only way to get the backup to change to a different type at the end/beginning of the month was to have some script handle it or you could manually control it. So here is a good shell script that looks at the day of the month and if it is the 1st it runs a backup to an alternate nodename. In this example the nodename is the same as the default nodename with -MONTHLY added to the end. We also made a dsm.opt file called dsm.opt.monthly that references the stanza in the dsm.sys with the alternate name. Then schedule this script as a daily command script for the node and it will run the daily incremental to the default nodename every day except on the 1st of the month. I hope this is useful for some of you. Click Read More to see the script.
if [ -f $BK_SCRIPT_LOGFILE ]; then
mv $BK_SCRIPT_LOGFILE $BK_SCRIPT_LOGFILE.`date +%d`
printf "`date` - Starting Backup\n" >> $BK_SCRIPT_LOGFILE
printf " test " >> $BK_SCRIPT_LOGFILE
# Modified to use the monthly opt file on the 1st for monthly backups that are
# kept for a extended period of time.
case `date +%d` in
# Back up the filesystems
printf "`date` - Starting the backup of the filesystems.\n" >> $BK_SCRIPT_LOGFILE
# Set the success variable to zero
/opt/tivoli/tsm/client/ba/bin/dsmc incr >> $BK_SCRIPT_LOGFILE
# /opt/tivoli/tsm/client/ba/bin/dsmc q fi >> $BK_SCRIPT_LOGFILE INCRCODE=$?
if [[ $INCRCODE -ne 0 && $INCRCODE -ne 4 && $INCRCODE -ne 8 ]]
printf "`date` - Incremental backup failed - return code: $INCRCODE\n" >> $BK_SCRIPT_LOGFILE
printf "`date` - Incremental of $FS successful - return code: $INCRCODE\n" >> $BK_SCRIPT_LOGFILE
printf "`date` - Backup has completed successfully\n" >> $BK_SCRIPT_LOGFILE
That's a really interesting way of doing it that never occurred to me. (I've set up separate schedules to do the same thing before, but this does make a lot of sense)