SearchFAQMemberlist Log in
Reply to topic Page 1 of 1
rsnapshot/utils rsnapshot_invert.sh,NONE
Author Message
Post rsnapshot/utils rsnapshot_invert.sh,NONE 
Update of /cvsroot/rsnapshot/rsnapshot/utils
In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv31762/utils

Added Files:
rsnapshot_invert.sh
Log Message:
New script rsnapshot_invert.sh creates a parallel directory hierarchy
arranged like backup_point/backup_name instead of backup_name/backup_point
with a combination of directories for backup points and symlinks for the
backup names


--- NEW FILE: rsnapshot_invert.sh ---
#!/bin/bash

# $Id: rsnapshot_invert.sh,v 1.1 2007/04/12 16:51:58 drhyde Exp $

# This script takes one parameter, which should be your rsnapshot config
# file. It will parse that file to find your snapshot_root, backup points,
# and interval/retain values, and will create from those an inverted
# directory structure of backup points containing daily.{0,1,2,3} etc
# symlinks. Run it from a cron job to keep that structure up to date.
#
# There is minimal^Wno error checking, and the parsing is totally brain-
# dead.

SNAPSHOT_ROOT=`grep ^snapshot_root $1|awk '{print \$2}'`
BACKUPS=`grep ^backup $1|awk '{print \$3}'`
INTERVALS=`grep -E '^(interval|retain)' $1|awk '{print \$2}'`

cd $SNAPSHOT_ROOT
for i in $BACKUPS; do
mkdir $i
for j in $INTERVALS; do
HOWMANY=`grep -E ^\(interval\|retain\).$j $1|awk '{print \$3}'`
COUNT=0
while [[ $COUNT != $HOWMANY ]]; do
ln -s $SNAPSHOT_ROOT/$j.$COUNT/$i $SNAPSHOT_ROOT/$i/$j.$COUNT
COUNT=$(($COUNT + 1))
done
done
done


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
rsnapshot-discuss mailing list
rsnapshot-discuss < at > lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rsnapshot-discuss

Display posts from previous:
Reply to topic Page 1 of 1
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 vote in polls in this forum
  


Magic SEO URL for phpBB