forked from ungleich-public/ccollect
Several minor changes
This commit is contained in:
parent
8b2bda8c40
commit
50c75ccf43
3 changed files with 59 additions and 7 deletions
1
Makefile
1
Makefile
|
@ -106,7 +106,6 @@ publish-doc: documentation
|
||||||
@echo "Transferring files to $(host)"
|
@echo "Transferring files to $(host)"
|
||||||
@chmod a+r $(DOCS) $(DOC_ALL)
|
@chmod a+r $(DOCS) $(DOC_ALL)
|
||||||
@tar c $(DOCS) $(DOC_ALL) | ssh $(host) "cd $(dir); tar xv"
|
@tar c $(DOCS) $(DOC_ALL) | ssh $(host) "cd $(dir); tar xv"
|
||||||
# @ssh $(host) "cd $(docdir); chmod -R a+r *"
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Distribution
|
# Distribution
|
||||||
|
|
15
ccollect.sh
15
ccollect.sh
|
@ -227,6 +227,7 @@ while [ "$i" -lt "$no_sources" ]; do
|
||||||
c_summary="$backup/summary"
|
c_summary="$backup/summary"
|
||||||
|
|
||||||
c_incomplete="$backup/incomplete_remove"
|
c_incomplete="$backup/incomplete_remove"
|
||||||
|
c_marker=".ccollect-${CDATE}.$$"
|
||||||
|
|
||||||
c_pre_exec="$backup/pre_exec"
|
c_pre_exec="$backup/pre_exec"
|
||||||
c_post_exec="$backup/post_exec"
|
c_post_exec="$backup/post_exec"
|
||||||
|
@ -266,7 +267,7 @@ while [ "$i" -lt "$no_sources" ]; do
|
||||||
# parameters
|
# parameters
|
||||||
#
|
#
|
||||||
if [ -x "$c_pre_exec" ]; then
|
if [ -x "$c_pre_exec" ]; then
|
||||||
echo "Executing $c_pre_exec ..."
|
echo "Executing ${c_pre_exec} ..."
|
||||||
"$c_pre_exec"
|
"$c_pre_exec"
|
||||||
echo "Finished ${c_pre_exec}."
|
echo "Finished ${c_pre_exec}."
|
||||||
|
|
||||||
|
@ -352,6 +353,7 @@ while [ "$i" -lt "$no_sources" ]; do
|
||||||
# show if we shall remove partial backup, and whether the last one
|
# show if we shall remove partial backup, and whether the last one
|
||||||
# is incomplete or not
|
# is incomplete or not
|
||||||
#
|
#
|
||||||
|
# FIXME: test general for incomplete and decide only for warn|delete based on option?
|
||||||
if [ -f "$c_incomplete" ]; then
|
if [ -f "$c_incomplete" ]; then
|
||||||
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)
|
||||||
|
|
||||||
|
@ -363,6 +365,7 @@ while [ "$i" -lt "$no_sources" ]; do
|
||||||
incomplete=$(cd "$last_dir" && ls .ccollect-????-??-)
|
incomplete=$(cd "$last_dir" && ls .ccollect-????-??-)
|
||||||
if [ "$incomplete" ]; then
|
if [ "$incomplete" ]; then
|
||||||
"Removing incomplete backup $last_dir ..."
|
"Removing incomplete backup $last_dir ..."
|
||||||
|
echo rm -rf $VVERBOSE "$last_dir"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -404,16 +407,16 @@ while [ "$i" -lt "$no_sources" ]; do
|
||||||
echo "Creating $destination_dir ..."
|
echo "Creating $destination_dir ..."
|
||||||
mkdir $VVERBOSE "$destination_dir" || exit 1
|
mkdir $VVERBOSE "$destination_dir" || exit 1
|
||||||
|
|
||||||
#
|
|
||||||
# FIXME: add marking here
|
|
||||||
# touch $c_marker
|
|
||||||
#
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# make an absolute path, perhaps $CCOLLECT_CONF is relative!
|
# make an absolute path, perhaps $CCOLLECT_CONF is relative!
|
||||||
#
|
#
|
||||||
abs_destination_dir="$(cd $destination_dir && pwd -P)"
|
abs_destination_dir="$(cd $destination_dir && pwd -P)"
|
||||||
|
|
||||||
|
#
|
||||||
|
# add mark
|
||||||
|
#
|
||||||
|
touch "${abs_destination_dir}/${c_marker}"
|
||||||
|
|
||||||
#
|
#
|
||||||
# the rsync part
|
# the rsync part
|
||||||
# options partly stolen from rsnapshot
|
# options partly stolen from rsnapshot
|
||||||
|
|
|
@ -808,3 +808,53 @@ rsync -av -H --delete /mnt/schwarzesloch/ "$DDIR/schwarzesloch/"
|
||||||
|
|
||||||
rsync -av -H --delete /mnt/archiv/ "$DDIR/archiv/"
|
rsync -av -H --delete /mnt/archiv/ "$DDIR/archiv/"
|
||||||
-------------------------------------------------------------------------
|
-------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
Processes running when doing ccollect -p
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
Truncated output from `ps axuwwwf`:
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------
|
||||||
|
S+ 11:40 0:00 | | | \_ /bin/sh /usr/local/bin/ccollect.sh daily -p ddba034 ddba045 ddba046 ddba047 ddba049 ddna010 ddna011
|
||||||
|
S+ 11:40 0:00 | | | \_ /bin/sh /usr/local/bin/ccollect.sh daily ddba034
|
||||||
|
S+ 11:40 0:00 | | | | \_ /bin/sh /usr/local/bin/ccollect.sh daily ddba034
|
||||||
|
R+ 11:40 23:40 | | | | | \_ rsync -a --delete --numeric-ids --relative --delete-excluded --link-dest=/home/server/backup/ddba034
|
||||||
|
S+ 11:40 0:00 | | | | | \_ ssh -l root ddba034.netstream.ch rsync --server --sender -vlogDtprR --numeric-ids . /
|
||||||
|
S+ 11:41 0:11 | | | | | \_ rsync -a --delete --numeric-ids --relative --delete-excluded --link-dest=/home/server/backup/ddb
|
||||||
|
S+ 11:40 0:00 | | | | \_ /bin/sh /usr/local/bin/ccollect.sh daily ddba034
|
||||||
|
S+ 11:40 0:00 | | | | \_ sed s:^:\[ddba034\] :
|
||||||
|
S+ 11:40 0:00 | | | \_ /bin/sh /usr/local/bin/ccollect.sh daily ddba045
|
||||||
|
S+ 11:40 0:00 | | | | \_ /bin/sh /usr/local/bin/ccollect.sh daily ddba045
|
||||||
|
R+ 11:40 0:02 | | | | | \_ rm -rf /etc/ccollect/sources/ddba045/destination/daily.2006-10-19-1807.6934
|
||||||
|
S+ 11:40 0:00 | | | | \_ /bin/sh /usr/local/bin/ccollect.sh daily ddba045
|
||||||
|
S+ 11:40 0:00 | | | | \_ sed s:^:\[ddba045\] :
|
||||||
|
S+ 11:40 0:00 | | | \_ /bin/sh /usr/local/bin/ccollect.sh daily ddba046
|
||||||
|
S+ 11:40 0:00 | | | | \_ /bin/sh /usr/local/bin/ccollect.sh daily ddba046
|
||||||
|
R+ 11:40 0:02 | | | | | \_ rm -rf /etc/ccollect/sources/ddba046/destination/daily.2006-10-19-1810.7072
|
||||||
|
S+ 11:40 0:00 | | | | \_ /bin/sh /usr/local/bin/ccollect.sh daily ddba046
|
||||||
|
S+ 11:40 0:00 | | | | \_ sed s:^:\[ddba046\] :
|
||||||
|
S+ 11:40 0:00 | | | \_ /bin/sh /usr/local/bin/ccollect.sh daily ddba047
|
||||||
|
S+ 11:40 0:00 | | | | \_ /bin/sh /usr/local/bin/ccollect.sh daily ddba047
|
||||||
|
R+ 11:40 0:03 | | | | | \_ rm -rf /etc/ccollect/sources/ddba047/destination/daily.2006-10-19-1816.7268
|
||||||
|
S+ 11:40 0:00 | | | | \_ /bin/sh /usr/local/bin/ccollect.sh daily ddba047
|
||||||
|
S+ 11:40 0:00 | | | | \_ sed s:^:\[ddba047\] :
|
||||||
|
S+ 11:40 0:00 | | | \_ /bin/sh /usr/local/bin/ccollect.sh daily ddba049
|
||||||
|
S+ 11:40 0:00 | | | | \_ /bin/sh /usr/local/bin/ccollect.sh daily ddba049
|
||||||
|
D+ 11:40 0:03 | | | | | \_ rm -rf /etc/ccollect/sources/ddba049/destination/daily.2006-10-19-1821.7504
|
||||||
|
S+ 11:40 0:00 | | | | \_ /bin/sh /usr/local/bin/ccollect.sh daily ddba049
|
||||||
|
S+ 11:40 0:00 | | | | \_ sed s:^:\[ddba049\] :
|
||||||
|
S+ 11:40 0:00 | | | \_ /bin/sh /usr/local/bin/ccollect.sh daily ddna010
|
||||||
|
S+ 11:40 0:00 | | | | \_ /bin/sh /usr/local/bin/ccollect.sh daily ddna010
|
||||||
|
R+ 11:40 0:03 | | | | | \_ rm -rf /etc/ccollect/sources/ddna010/destination/daily.2006-10-19-1805.6849
|
||||||
|
S+ 11:40 0:00 | | | | \_ /bin/sh /usr/local/bin/ccollect.sh daily ddna010
|
||||||
|
S+ 11:40 0:00 | | | | \_ sed s:^:\[ddna010\] :
|
||||||
|
S+ 11:40 0:00 | | | \_ /bin/sh /usr/local/bin/ccollect.sh daily ddna011
|
||||||
|
S+ 11:40 0:00 | | | \_ /bin/sh /usr/local/bin/ccollect.sh daily ddna011
|
||||||
|
R+ 12:08 0:00 | | | | \_ rm -rf /etc/ccollect/sources/ddna011/destination/daily.2006-10-20-1502.7824
|
||||||
|
S+ 11:40 0:00 | | | \_ /bin/sh /usr/local/bin/ccollect.sh daily ddna011
|
||||||
|
S+ 11:40 0:00 | | | \_ sed s:^:\[ddna011\] :
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------
|
||||||
|
As you can see, six processes are deleting old backups, while one backup
|
||||||
|
(ddba034) is already copying data.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue