BashScripts.org
http://bashscripts.org/forum/

TSM-Restore Script
http://bashscripts.org/forum/viewtopic.php?f=8&t=1484
Page 1 of 1

Author:  r3v4n [ Wed Nov 09, 2011 4:07 am ]
Post subject:  TSM-Restore Script

Hello everyone,

I need to restore about 250 files from TSM and I've had the idea to do this via Bash Script.

All files are named like
<name_is_always_the_same>_DATE_TIMESTAMP
(<name_is_always_the_same>_2011-11-09_04-34-26.714)

I need to restore all files between _2010-10-01_* and _2011-10-31_*

Every day has to be checked, if there are files available here and if there are, the script
should execute a command like "dsmc restore /path/<filename>_DATE_TIMESTAMP /path/restore"

Can anyone help me with this problem? I'm a total noob in scripting :(

Thank you all in advance für your help!

Greetings

Author:  choroba [ Wed Nov 09, 2011 5:54 am ]
Post subject:  Re: TSM-Restore Script

Let's assume the list of files is given in list.txt and $prefix contains the repating name part. Then something like this should work:
Code:
#! /bin/bash
from="$prefix"2010-10-01
to="$prefix"2011-10-31

{
    echo "$from"_00-00-00.00%$'\n'"$to"_23-59-59.999%
    cat list.txt
} | sort > list.txt2

sed -n "/%$/,/%$/p" list.txt2 | grep -v '%$' |
    xargs -I% dsmc restore % /path/restore

Page 1 of 1 All times are UTC - 6 hours
© 2000, 2002, 2005, 2007 phpBB Group • http://www.phpbb.com