From b07299b7602e21134d73ebc28c3f24f34804046c Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 22 Jan 2006 11:13:22 +0100 Subject: [PATCH] Implemented general pre- and post-exec commands --- ccollect.sh | 23 ++++++++++++++++++++--- doc/TODO | 4 ++++ doc/ccollect.text | 3 +++ 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/ccollect.sh b/ccollect.sh index 0373f95..9a04441 100755 --- a/ccollect.sh +++ b/ccollect.sh @@ -10,10 +10,13 @@ CCOLLECT_CONF=${CCOLLECT_CONF:-/etc/ccollect} CSOURCES=$CCOLLECT_CONF/sources CDEFAULTS=$CCOLLECT_CONF/defaults +CPREEXEC="$CDEFAULTS/pre_exec" +CPOSTEXEC="$CDEFAULTS/post_exec" + TMP=$(mktemp /tmp/$(basename $0).XXXXXX) WE=$(basename $0) -VERSION=0.2 -RELEASE="2006-01-13" +VERSION=0.3 +RELEASE="2006-01-22" # # unset parallel execution @@ -50,7 +53,7 @@ usage() echo "" echo " Retrieve latest ccollect at http://linux.schottelius.org/ccollect/." echo "" - echo " Version: $VERSION ($RELEASE, Black Friday Release)" + echo " Version: $VERSION ($RELEASE, Grey Sunday Release)" exit 0 } @@ -154,6 +157,13 @@ fi D_FILE_INTERVALL="$CDEFAULTS/intervalls/$INTERVALL" D_INTERVALL=$(cat $D_FILE_INTERVALL 2>/dev/null) +# +# Look for pre-exec command (general) +# +if [ -x "$CPREEXEC" ]; then + "$CPREEXEC" +fi + # # Let's do the backup # @@ -348,5 +358,12 @@ if [ "$PARALLEL" ]; then wait fi +# +# Look for post-exec command (general) +# +if [ -x "$POSTEXEC" ]; then + "$POSTEXEC" +fi + rm -f "$TMP" echo "==> Finished $WE <==" diff --git a/doc/TODO b/doc/TODO index b4f9a39..bd18884 100644 --- a/doc/TODO +++ b/doc/TODO @@ -1,3 +1,7 @@ +- implement pre- and post-exec commands + o For the general backup process + o source specific + - Documentation - write/generate a manpage - rsync_options \n seperated diff --git a/doc/ccollect.text b/doc/ccollect.text index 0654320..ebdcd3a 100644 --- a/doc/ccollect.text +++ b/doc/ccollect.text @@ -426,3 +426,6 @@ srwali01:/etc/ccollect/sources# du -sh /mnt/hdbackup/wl6/* 147M /mnt/hdbackup/wl6/taeglich.2005-12-08-14:42.312 147M /mnt/hdbackup/wl6/taeglich.2005-12-08-14:45.588 ------------------------------------------------------------------------- + + +pre/postexec: only when executable!