Added 90% of functionality, added more configuration examples

This commit is contained in:
Nico Schottelius 2005-12-08 10:27:39 +01:00
parent 967556b693
commit 09b10f4776
8 changed files with 44 additions and 14 deletions

View file

@ -209,16 +209,14 @@ while [ "$i" -lt "$no_shares" ]; do
done < "$c_exclude" done < "$c_exclude"
fi fi
#
# TODO
#
# #
# check if maximum number of backups is reached, if so remove # check if maximum number of backups is reached, if so remove
# #
# STOPPED! #
count=$(ls "$c_dest/${INTERVALL}.*" | wc -l) # the created directories are named $INTERVALL.$DATE
#
count=$(ls -d "$c_dest/${INTERVALL}."?* 2>/dev/null | wc -l)
echo "|-> $count backup(s) already exist, keeping $c_intervall backup(s)." echo "|-> $count backup(s) already exist, keeping $c_intervall backup(s)."
if [ "$count" -ge "$c_intervall" ]; then if [ "$count" -ge "$c_intervall" ]; then
@ -226,26 +224,47 @@ while [ "$i" -lt "$no_shares" ]; do
remove=$(echo $count - $substract | bc) remove=$(echo $count - $substract | bc)
echo "|-> Removing $remove backups..." echo "|-> Removing $remove backups..."
ls "$c_dest/${INTERVALL}.*" | sort -n | head -n $remove > "$TMP" ls -d "$c_dest/${INTERVALL}."?* | sort -n | head -n $remove > "$TMP"
while read to_remove; do while read to_remove; do
dir="$c_dest/$to_remove" dir="$to_remove"
echo "|-> Removing $dir ..." echo "|-> Removing $dir ..."
rm -rf "$dir" echo rm -rf "$dir"
done < "$TMP" done < "$TMP"
fi fi
# #
# clone the old directory with hardlinks # clone the old directory with hardlinks
# #
destination_date=$(date +%Y-%m-%d-%H:%M)
destination_dir="$c_dest/${INTERVALL}.${destination_date}/"
last_dir=$(ls -d "$c_dest/${INTERVALL}."?* 2>/dev/null | sort -n | tail -n 1)
# only copy if there exists a directory
if [ "$last_dir" ]; then
echo cp -al "$last_dir" "$destination_dir"
else
mkdir "$destination_dir"
fi
if [ $? -ne 0 ]; then
errecho "Creating backup directory failed. Skipping backup."
continue
fi
# #
# the rsync part # the rsync part
# --delete --numeric-ids --relative --delete-excluded # options stolen shameless from rsnapshot
# #
# STOPPED! echo rsync -a --delete --numeric-ids --relative --delete-excluded \
destination_dir=$(date +%Y-%m-%d) $EXCLUDE $VERBOSE $EXCLUDE "$source" "$destination_dir"
echo rsync -a --delete $EXCLUDE $VERBOSE $EXCLUDE "$source" "$c_dest/${INTERVALL}.${destination_dir}"
if [ $? -ne 0 ]; then
errecho "rsync failed, backup most likely broken"
continue
fi
done done
# #

View file

@ -0,0 +1 @@
28

View file

@ -0,0 +1,3 @@
openvpn-2.0.1.tar.gz
nicht_reinnehmen
etwas mit leerzeichenli

View file

@ -0,0 +1 @@
2

View file

@ -0,0 +1 @@
/home/nico/vpn

View file

@ -0,0 +1 @@
manage

View file

@ -0,0 +1 @@
nico@creme.schottelius.org:bin

View file

@ -0,0 +1,3 @@
openvpn-2.0.1.tar.gz
nicht_reinnehmen
etwas mit leerzeichenli