Implemented general pre- and post-exec commands

This commit is contained in:
Nico Schottelius 2006-01-22 11:13:22 +01:00
parent 6ae76a800c
commit b07299b760
3 changed files with 27 additions and 3 deletions

View file

@ -10,10 +10,13 @@
CCOLLECT_CONF=${CCOLLECT_CONF:-/etc/ccollect} CCOLLECT_CONF=${CCOLLECT_CONF:-/etc/ccollect}
CSOURCES=$CCOLLECT_CONF/sources CSOURCES=$CCOLLECT_CONF/sources
CDEFAULTS=$CCOLLECT_CONF/defaults CDEFAULTS=$CCOLLECT_CONF/defaults
CPREEXEC="$CDEFAULTS/pre_exec"
CPOSTEXEC="$CDEFAULTS/post_exec"
TMP=$(mktemp /tmp/$(basename $0).XXXXXX) TMP=$(mktemp /tmp/$(basename $0).XXXXXX)
WE=$(basename $0) WE=$(basename $0)
VERSION=0.2 VERSION=0.3
RELEASE="2006-01-13" RELEASE="2006-01-22"
# #
# unset parallel execution # unset parallel execution
@ -50,7 +53,7 @@ usage()
echo "" echo ""
echo " Retrieve latest ccollect at http://linux.schottelius.org/ccollect/." echo " Retrieve latest ccollect at http://linux.schottelius.org/ccollect/."
echo "" echo ""
echo " Version: $VERSION ($RELEASE, Black Friday Release)" echo " Version: $VERSION ($RELEASE, Grey Sunday Release)"
exit 0 exit 0
} }
@ -154,6 +157,13 @@ fi
D_FILE_INTERVALL="$CDEFAULTS/intervalls/$INTERVALL" D_FILE_INTERVALL="$CDEFAULTS/intervalls/$INTERVALL"
D_INTERVALL=$(cat $D_FILE_INTERVALL 2>/dev/null) 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 # Let's do the backup
# #
@ -348,5 +358,12 @@ if [ "$PARALLEL" ]; then
wait wait
fi fi
#
# Look for post-exec command (general)
#
if [ -x "$POSTEXEC" ]; then
"$POSTEXEC"
fi
rm -f "$TMP" rm -f "$TMP"
echo "==> Finished $WE <==" echo "==> Finished $WE <=="

View file

@ -1,3 +1,7 @@
- implement pre- and post-exec commands
o For the general backup process
o source specific
- Documentation - Documentation
- write/generate a manpage - write/generate a manpage
- rsync_options \n seperated - rsync_options \n seperated

View file

@ -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:42.312
147M /mnt/hdbackup/wl6/taeglich.2005-12-08-14:45.588 147M /mnt/hdbackup/wl6/taeglich.2005-12-08-14:45.588
------------------------------------------------------------------------- -------------------------------------------------------------------------
pre/postexec: only when executable!