-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* rsnapshot-rotate.sh - don't remount on each run * rsnapshot-wrapper.sh - various modifications merged, TODO added Signed-off-by: Christian Kujau <[email protected]>
- Loading branch information
Showing
5 changed files
with
106 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,7 @@ | |
# | ||
# (c)2013 Christian Kujau <[email protected]> | ||
# | ||
# Generate checksums of files and store them | ||
# via Extended Attributes | ||
# Generate checksums of files and store them via Extended Attributes | ||
# | ||
# == Requirements == | ||
# Darwin: /sbin/md5 or openssl | ||
|
@@ -40,7 +39,7 @@ print_usage() | |
echo "* check-set - sets a new checksum if none is found, verify checksum otherwise." | ||
} | ||
|
||
if [ $# -ne 2 -o ! -f "$2" ]; then | ||
if [ $# -ne 2 ] || [ ! -f "$2" ]; then | ||
print_usage | ||
exit 1 | ||
else | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
#!/bin/sh | ||
# | ||
# (c)2011 Christian Kujau <[email protected]> | ||
# | ||
# Forcefully rotate rsnapshot backups, intentionally discard older copies | ||
# Forcefully rotate rsnapshot backups, intentionally discarding older copies | ||
# | ||
CONF="/etc/rsnapshot" | ||
|
||
|
@@ -14,16 +13,25 @@ else | |
CONF="$CONF"/rsnapshot-"$1".conf | ||
DIR=`awk '/^snapshot_root/ {print $2}' $CONF` | ||
|
||
# Don't let rsnapshot-wrapper remount our backup store | ||
WRAPPER_CONF="/usr/local/etc/rsnapshot-wrapper.conf" | ||
NOMOUNT=$(awk -F= '/^NOMOUNT/ {print $2}' $WRAPPER_CONF) | ||
touch "$NOMOUNT" | ||
|
||
[ -f "$CONF" ] || exit 2 | ||
[ -d "$DIR" ] || exit 3 | ||
fi | ||
|
||
for i in daily weekly monthly; do | ||
C=`ls -d "$DIR"/"$i".* | wc -l` | ||
C=`ls -d "$DIR"/"$i".* 2>/dev/null | wc -l` | ||
j=0 | ||
while [ $j -le $C ]; do | ||
echo "("$j"/"$C") rsnapshot -c "$CONF" "$i"..." | ||
rsnapshot -c "$CONF" "$i" | ||
j=$((j+1)) | ||
done | ||
done | ||
|
||
# Since this is not a normal operation and may take a long time, we will | ||
# remove the NOMOUNT flag again, otherwise we may forget to remove it. | ||
rm -f "$NOMOUNT" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters