Whitespace cleanup
This commit is contained in:
parent
952adc32f2
commit
b31989c476
1 changed files with 18 additions and 18 deletions
36
ccollect.sh
36
ccollect.sh
|
@ -90,7 +90,7 @@ no_sources=0
|
||||||
|
|
||||||
while [ $i -le $# ]; do
|
while [ $i -le $# ]; do
|
||||||
eval arg=\$$i
|
eval arg=\$$i
|
||||||
|
|
||||||
if [ "$NO_MORE_ARGS" = 1 ]; then
|
if [ "$NO_MORE_ARGS" = 1 ]; then
|
||||||
eval source_${no_sources}=\"$arg\"
|
eval source_${no_sources}=\"$arg\"
|
||||||
no_sources=$(($no_sources+1))
|
no_sources=$(($no_sources+1))
|
||||||
|
@ -148,7 +148,7 @@ fi
|
||||||
if [ "$ALL" = 1 ]; then
|
if [ "$ALL" = 1 ]; then
|
||||||
# reset everything specified before
|
# reset everything specified before
|
||||||
no_sources=0
|
no_sources=0
|
||||||
|
|
||||||
#
|
#
|
||||||
# get entries from sources
|
# get entries from sources
|
||||||
#
|
#
|
||||||
|
@ -160,7 +160,7 @@ if [ "$ALL" = 1 ]; then
|
||||||
echo "Listing of sources failed. Aborting."
|
echo "Listing of sources failed. Aborting."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while read tmp; do
|
while read tmp; do
|
||||||
eval source_${no_sources}=\"$tmp\"
|
eval source_${no_sources}=\"$tmp\"
|
||||||
no_sources=$(($no_sources+1))
|
no_sources=$(($no_sources+1))
|
||||||
|
@ -171,7 +171,7 @@ fi
|
||||||
# Need at least ONE source to backup
|
# Need at least ONE source to backup
|
||||||
#
|
#
|
||||||
if [ "$no_sources" -lt 1 ]; then
|
if [ "$no_sources" -lt 1 ]; then
|
||||||
usage
|
usage
|
||||||
else
|
else
|
||||||
echo "==> $HALF_VERSION: Beginning backup using interval $INTERVAL <=="
|
echo "==> $HALF_VERSION: Beginning backup using interval $INTERVAL <=="
|
||||||
fi
|
fi
|
||||||
|
@ -250,7 +250,7 @@ while [ "$i" -lt "$no_sources" ]; do
|
||||||
echo "Source does not exist."
|
echo "Source does not exist."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
# configuration _must_ be a directory
|
# configuration _must_ be a directory
|
||||||
#
|
#
|
||||||
|
@ -316,28 +316,28 @@ while [ "$i" -lt "$no_sources" ]; do
|
||||||
if [ -f "$c_exclude" ]; then
|
if [ -f "$c_exclude" ]; then
|
||||||
EXCLUDE="--exclude-from=$c_exclude"
|
EXCLUDE="--exclude-from=$c_exclude"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
# extra options for rsync
|
# extra options for rsync
|
||||||
#
|
#
|
||||||
if [ -f "$c_rsync_extra" ]; then
|
if [ -f "$c_rsync_extra" ]; then
|
||||||
RSYNC_EXTRA="$(cat "$c_rsync_extra")"
|
RSYNC_EXTRA="$(cat "$c_rsync_extra")"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
# Output a summary
|
# Output a summary
|
||||||
#
|
#
|
||||||
if [ -f "$c_summary" ]; then
|
if [ -f "$c_summary" ]; then
|
||||||
SUMMARY="--stats"
|
SUMMARY="--stats"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
# Verbosity for rsync
|
# Verbosity for rsync
|
||||||
#
|
#
|
||||||
if [ -f "$c_verbose" ]; then
|
if [ -f "$c_verbose" ]; then
|
||||||
VERBOSE="-v"
|
VERBOSE="-v"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
# MORE verbosity, includes standard verbosity
|
# MORE verbosity, includes standard verbosity
|
||||||
#
|
#
|
||||||
|
@ -345,16 +345,16 @@ while [ "$i" -lt "$no_sources" ]; do
|
||||||
VERBOSE="-v"
|
VERBOSE="-v"
|
||||||
VVERBOSE="-v"
|
VVERBOSE="-v"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
# check if maximum number of backups is reached, if so remove
|
# check if maximum number of backups is reached, if so remove
|
||||||
#
|
#
|
||||||
|
|
||||||
# the created directories are named $INTERVAL-$DATE-$TIME.$PID
|
# the created directories are named $INTERVAL-$DATE-$TIME.$PID
|
||||||
count=$(ls -d "$c_dest/${INTERVAL}."?* 2>/dev/null | wc -l | sed 's/^ *//g')
|
count=$(ls -d "$c_dest/${INTERVAL}."?* 2>/dev/null | wc -l | sed 's/^ *//g')
|
||||||
echo -n "Currently $count backup(s) exist(s),"
|
echo -n "Currently $count backup(s) exist(s),"
|
||||||
echo " total keeping $c_interval backup(s)."
|
echo " total keeping $c_interval backup(s)."
|
||||||
|
|
||||||
if [ "$count" -ge "$c_interval" ]; then
|
if [ "$count" -ge "$c_interval" ]; then
|
||||||
substract=$((${c_interval} - 1))
|
substract=$((${c_interval} - 1))
|
||||||
remove=$(($count - $substract))
|
remove=$(($count - $substract))
|
||||||
|
@ -367,16 +367,16 @@ while [ "$i" -lt "$no_sources" ]; do
|
||||||
rm $VVERBOSE -rf "$dir"
|
rm $VVERBOSE -rf "$dir"
|
||||||
done < "$TMP"
|
done < "$TMP"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
# clone the old directory with hardlinks
|
# clone the old directory with hardlinks
|
||||||
#
|
#
|
||||||
|
|
||||||
destination_date=$($CDATE)
|
destination_date=$($CDATE)
|
||||||
destination_dir="$c_dest/${INTERVAL}.${destination_date}.$$"
|
destination_dir="$c_dest/${INTERVAL}.${destination_date}.$$"
|
||||||
|
|
||||||
last_dir=$(ls -d "$c_dest/${INTERVAL}."?* 2>/dev/null | sort -n | tail -n 1)
|
last_dir=$(ls -d "$c_dest/${INTERVAL}."?* 2>/dev/null | sort -n | tail -n 1)
|
||||||
|
|
||||||
# give some info
|
# give some info
|
||||||
echo "Beginning to backup, this may take some time..."
|
echo "Beginning to backup, this may take some time..."
|
||||||
|
|
||||||
|
@ -392,7 +392,7 @@ while [ "$i" -lt "$no_sources" ]; do
|
||||||
# the rsync part
|
# the rsync part
|
||||||
# options partly stolen from rsnapshot
|
# options partly stolen from rsnapshot
|
||||||
#
|
#
|
||||||
|
|
||||||
echo "$($DDATE) Transferring files..."
|
echo "$($DDATE) Transferring files..."
|
||||||
|
|
||||||
ouropts="-a --delete --numeric-ids --relative --delete-excluded"
|
ouropts="-a --delete --numeric-ids --relative --delete-excluded"
|
||||||
|
@ -400,7 +400,7 @@ while [ "$i" -lt "$no_sources" ]; do
|
||||||
|
|
||||||
# Clone from previous backup, if existing
|
# Clone from previous backup, if existing
|
||||||
if [ "$last_dir" ]; then
|
if [ "$last_dir" ]; then
|
||||||
|
|
||||||
#
|
#
|
||||||
# This directory MUST be absolute, because rsync does chdir()
|
# This directory MUST be absolute, because rsync does chdir()
|
||||||
# before beginning backup!
|
# before beginning backup!
|
||||||
|
@ -466,7 +466,7 @@ if [ -x "$CPOSTEXEC" ]; then
|
||||||
echo "$($DDATE) Executing $CPOSTEXEC ..."
|
echo "$($DDATE) Executing $CPOSTEXEC ..."
|
||||||
"$CPOSTEXEC"
|
"$CPOSTEXEC"
|
||||||
echo "$($DDATE) Finished ${CPOSTEXEC}."
|
echo "$($DDATE) Finished ${CPOSTEXEC}."
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "$CPOSTEXEC failed."
|
echo "$CPOSTEXEC failed."
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Add table
Reference in a new issue