Register
It is currently Mon Sep 01, 2014 5:15 am

TSM-Restore Script


All times are UTC - 6 hours


Post new topic Reply to topic  [ 2 posts ] 
Author Message
 PostPosted: Wed Nov 09, 2011 4:07 am   

Joined: Wed Nov 09, 2011 3:05 am
Posts: 1
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


Top
 Profile  
 PostPosted: Wed Nov 09, 2011 5:54 am   
User avatar

Joined: Tue Apr 27, 2010 2:28 pm
Posts: 172
Location: Czech Republic
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


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot] and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP