SearchFAQMemberlist Log in
Reply to topic Page 1 of 1
do-rsnapshots: intelligent and fully automatic management ho
Author Message
Post do-rsnapshots: intelligent and fully automatic management ho 
Hallo,

I post it again (and the doc too), because its not in the archive Sad
Still not in the archive Sad, but I dont give up and post the doc and the
script as text in this mail.

If you copy the script from here, look for
# delete linefeed in the next line
and do ist first.

Why??

Looks like it doesnt work with the digital sig, trying without it and
without references...

If its bad, tell me!!


do-rsnapshots.txt #####################################

(English version below)

do-rsnapshots: intelligente and vollautomatische Verwaltung der rsnapshot
Ordner hourly daily weekly monthly yearly

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public
License as published by the Free Software Foundation; either version
2 of the License, or (at your option) any later
version.

This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.

Ich benutze rsnapshot seit 2006 mit Suse Linux auf meinem Desktop und bin
sehr zufrieden damit.
Herzlichen Dank an die Entwickler!

Seit Mai 2010 habe ich einen Laptop mit Suse Linux 11.2 und beWhy??

Looks like it doesnt work with the digital sig, trying without it and
without references...

If its bad, tell me!!nutze rsnapshot-1.3.1.

Ich habe in rsnapshot.conf

interval hourly 8
interval daily 7
interval weekly 4
interval monthly 12
interval yearly 100

stehen, da ich meine alten Daten behalten möchte.


In der Crontab müßte

0 * * * * /usr/bin/rsnapshot hourly
50 23 * * * /usr/bin/rsnapshot daily
40 23 * * 6 /usr/bin/rsnapshot weekly
30 23 1 * * /usr/bin/rsnapshot monthly
20 23 1 1 * /usr/bin/rsnapshot yearly

Da der Laptop nur sehr unregelmäßig läuft, ist die Verwaltung der
Verzeichnisebenen daily weekly monthly und yearly unsicher.

Läuft er nach 23:00 nicht mehr, wird kein rsnapshot daily weekly monthly
oder yearly gemacht.

Deshalb habe ich do-rsnapshots geschrieben, so dass in der Crontab nur noch

0 * * * * /usr/bin/do-rsnapshots

nötig ist. (Ich setze gerne noch ein nice davor, damit ich nicht beim
Arbeiten oder was auch immer gestört werde.)
0 * * * * nice /usr/bin/do-rsnapshots


do-rsnapshots wird statt rsnapshot hourly ausfgeführt und löst das Problem
so:

do-rsnapshots liest zunächst die Konfigurationdatei und weiß dann, wieviele
Updates auf jeder Ebene vorhanden sein sollen.

Dann wird geprüft, ob das letzte monthly Verzeichnis da ist. Wenn ja, wird
yearly.0 geprüft.
Ist das nicht vorhanden oder nicht vom gleichen Jahr wie das älteste monthly
Verzeichnis , wird rsnapshot yearly mit allen Optionen aufgerufen, die in
der Kommandozeile von do-rsnapshots stehen.
Ebenso wird mit den Verzeichnisebenen monthly weekly und daily verfahren.

Zum Schluß wird, falls aktiviert, rsnapshot sync und dann rsnapshot hourly
ebenfalls mit allen Optionen aufgerufen.(Siehe unten!)

Dadurch wird die Backup-Hierarchie automatisch aufgebaut und verwaltet.

Da die gesamte Arbeit von rsnapshot gemacht wird, hoffe ich, keine neuen
Fehlerquellen (Ausnahme siehe unten) eingeführt zu haben,


Es ist auch ohne weiteres möglich, andere Anforderungen zu realisieren.

Will man z. B. für ein Jahr tägliche Updates um vier Uhr haben und danach
nur noch jährliche, muß in rsnapshot.conf

interval daily 366
interval yearly 100

stehen und der Rest passiert automatisch mit

0 4 * * * /usr/bin/do-rsnapshots

in der Crontab. Allerdings habe ich das nicht getestet. ;-)

VORAUSSETZUNGEN:
Man darf nur die bekannten Intervalnamen hourly, daily, weekly, monthly und
yearly benutzen.
Natürlich muß die bash installiert sein, ebenso grep und die coreutils für
cat und cut


BEKANNTE FEHLER:
Ich habe die args aus man rsnapshot nicht implementiert
SYNOPSIS
rsnapshot [-vtxqVD] [-c cfgfile] [command] [args]


Falls Sie irgendwelche Fehler finden oder Anregungen haben, schicken Sie mir
eine Mail an rolf.muth < at > web.de

Herzliche Grüße!
Rolf Muth

PGP Public Key fuer "Rolf Muth (inet)" auf http://pgp.mit.edu/



ENGLISH VERSION

do-rsnapshots: intelligent and fully automatic management for rsnapshot
folders daily weekly monthly yearly

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public
License as published by the Free Software Foundation; either version
2 of the License, or (at your option) any later
version.

This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.

I use rsnapshot since 2006 with Suse Linux at my desktop and are very happy
to have it..
Many thanks to the developers.

Since 2010 I have a laptop with Suse Linux 11.2 use rsnapshot-1.3.1.

I have in rsnapshot.conf

interval hourly 8
interval daily 7
interval weekly 4
interval monthly 12
interval yearly 100

because I want to hold on my old data.

In the crontab should be

0 * * * * /usr/bin/rsnapshot hourly
50 23 * * * /usr/bin/rsnapshot daily
40 23 * * 6 /usr/bin/rsnapshot weekly
30 23 1 * * /usr/bin/rsnapshot monthly
20 23 1 1 * /usr/bin/rsnapshot yearly

Since the laptop is not always running, its very unsure when the daily
weekly monthly and yearly backups are made
If it is not running after 23:00, there is no rsnapshot daily weekly monthly
oder yearly.

Therefore I wrote do-rsnapshots, that calls rsnapshot as needed.

In the crontab now is only

0 * * * * /usr/bin/do-rsnapshots


do-rsnapshots first reads the rsnapshot configuration file and then knows
how many updates should be there for each of daily weekly monthly or
yearly.

Then it looks for the last monthly folder. If it exists, it looks for
yearly.0. If that does not exist or is not made in the same year as the
oldest monthly folder, rsnapshot yearly is called with all options from the
command line of do-rsnapshots.

The same is done with monthly weekly and daily.

At last it calls (rsnapshot sync if activated and) rsnapshot hourly with all
options from the command line of do-rsnapshots.


So the backup folders are automatically build and managed.

Since all the actual work is done by rsnapshot, I hope, there are no new
bugs (exception see below).

It is also possible, to do different things.

If you want to have one daily update for a whole year (huh Smile and then only
the yearly ones, you ought to have in rsnapshot.conf

interval daily 366
interval yearly 100

it all goes automatically with

0 14 * * * /usr/bin/do-rsnapshots

in crontab. But I didn't test that. ;-)

REQUIREMENTS:
You have to use only some of the the known interval names hourly, daily,
weekly, monthly and yearly.
Of course the bash has to be installed, also grep and the coreutils for cat
and cut


KNOWN BUGS
I didn't implement the args in man rsnapshot
SYNOPSIS
rsnapshot [-vtxqVD] [-c cfgfile] [command] [args]



If you have any bug reports or suggestions, please send mail to
rolf.muth < at > web.de

With kind regards!
Rolf Muth

PGP Public Key:
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xF8DC41935544C89A




do-rsnapshots #######################################

#!/bin/bash
#
# do-rsnapshots statt rsnapshot hourly ausführen
#
VERSION="do-rsnapshots v0.13 30.8.10 (c) Rolf Muth GPL v2 or later"
# selbst laptop v0.1 19.8.10
#
# intelligent and fully automatic management only for the
# rsnapshot folders daily weekly monthly yearly
# do-rsnapshots runs
# rsnapshot daily
# rsnapshot weekly
# rsnapshot monthly
# rsnapshot yearly
# automatically, when needed
# all the work is done by rsnapshot
# all options are send to rsnapshot when calling it
#
# intelligente vollautomatische Verzeichnisverwaltung für rsnapshot
# funktioniert nur für daily weekly monthly yearly
# do-rsnapshots startet
# rsnapshot daily
# rsnapshot weekly
# rsnapshot monthly
# rsnapshot yearly
# automatisch, wenn nötig
# die gesamte Arbeit wird nur von rsnapshot getan
# Kommandozeilenparameter werden beim Aufruf an rsnapshot übergeben
#
# KNOWN BUGS
# I didnt implement the args in man rsnapshot
# SYNOPSIS
# rsnapshot [-vtxqVD] [-c cfgfile] [command] [args]



echo $VERSION
echo "Intelligent and full automatic management for"
echo "the rsnapshot folders daily weekly monthly yearly"
echo "(WITHOUT ANY WARRANTY - USE AT YOUR OWN RISK!)"

# Optionen festhalten
options="$ < at > "

# Konfigurationsdatei festlegen
while [[ -n $1 ]] && [[ $1 != "-c" ]]
do # echo s $1
shift
done
if [[ -n $1 ]] && [[ $1 == "-c" ]]
then
shift
konfdat=$1
else konfdat=/etc/rsnapshot.conf
fi # echo o $options; echo k $1; echo $konfdat

# aus der Konfigurationsdatei /etc/rsnapshot.conf lesen...
snapshot_root=$(cat $konfdat|/bin/grep -v "^#"|/bin/grep
snapshot_root|/usr/bin/cut -f 2)

sync_first=$(cat $konfdat|/bin/grep -v "^#"|/bin/grep
sync_first|/usr/bin/cut -f 2)
# echo $sync_first
if [ -z $sync_first ]
then sync_first=0
fi # echo $sync_first


declare -a feld
feld=($(cat $konfdat|/bin/grep -v "^#"|/bin/grep -w -E "retain|interval"))
# echo ${feld[ < at > ]}

# zum testen schrS=/home/inet/test/ ; snapshot_root=${schrS}.snapshots/
# echo $snapshot_root

if ! [ -d $snapshot_root ]
then exit 1
fi
ls -dl $snapshot_root

aktnr=$((${#feld[ < at > ]}-5))

while [[ $aktnr > 0 ]]
do
alt=${feld[$aktnr]} # echo alt $alt
altnr=$((${feld[$aktnr+1]}-1)) # echo altnr $altnr
altvz=${snapshot_root}$alt.$altnr # echo altvz $altvz
neu=${feld[$aktnr+3]} # echo $(($aktnr+3)) echo neu $neu
neuvz=${snapshot_root}$neu.0 # echo neuvz $neuvz echo $aktnr
case $neu in
yearly ) dateopt="+%Y" ;;
monthly ) dateopt="+%Y%m" ;;
weekly ) dateopt="+%Y%U" ;;
daily ) dateopt="+%Y%j" ;;
* ) dateopt=
echo "unbekanntes Intervall:" $neu
;;
esac # echo $alt $neu dateopt $dateopt

if [[ -n $dateopt ]] && [[ -d $altvz ]]
then
ls -ltd $neuvz $altvz
echo neu $(date -r $neuvz $dateopt) alt $(date -r $altvz $dateopt)
# delete linefeed in the next line
if ! [[ -d $altvz ]] || [[ $(date -r $neuvz $dateopt) != $(date -r
$altvz $dateopt) ]]
then
echo call rsnapshot $options $neu
rsnapshot $options $neu
fi
fi
aktnr=$(($aktnr-3)) # echo $aktnr
done

if [[ $sync_first == 1 ]]
then
echo call rsnapshot $options sync
rsnapshot $options sync
fi

echo call rsnapshot $options $alt # hourly
rsnapshot $options $alt # hourly

--
Herzliche Grüße!
Rolf Muth

Meine Adressen duerfen nicht fuer Werbung verwendet werden! PGP Public Key:
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xF8DC41935544C89A

------------------------------------------------------------------------------
uberSVN's rich system and user administration capabilities and model
configuration take the hassle out of deploying and managing Subversion and
the tools developers use with it. Learn more about uberSVN and get a free
download at: http://p.sf.net/sfu/wandisco-dev2dev
_______________________________________________
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