From 97d9f2ff1afe2e495f4b8c56b150437ac6dc0f68 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 22 Jan 2006 12:37:04 +0100 Subject: [PATCH] Added full pre-/post exec implementation and configuration --- ccollect.sh | 22 +++++++++++++++------- conf/sources/with_exec/destination | 1 + conf/sources/with_exec/post_exec | 5 +++++ conf/sources/with_exec/pre_exec | 5 +++++ conf/sources/with_exec/source | 1 + 5 files changed, 27 insertions(+), 7 deletions(-) create mode 120000 conf/sources/with_exec/destination create mode 100755 conf/sources/with_exec/post_exec create mode 100755 conf/sources/with_exec/pre_exec create mode 100644 conf/sources/with_exec/source diff --git a/ccollect.sh b/ccollect.sh index 45b2968..27385e2 100755 --- a/ccollect.sh +++ b/ccollect.sh @@ -68,19 +68,18 @@ fi # check for configuraton directory # if [ ! -d "$CCOLLECT_CONF" ]; then - echo "Configuration \"$CCOLLECT_CONF\" not found." + echo "No configuration found in \"$CCOLLECT_CONF\"" \ + " (set \$CCOLLECT_CONF corectly?)" exit 1 fi # # Filter arguments # - INTERVALL=$1; shift i=1 no_shares=0 -set -x while [ $i -le $# ]; do eval arg=\$$i @@ -161,7 +160,9 @@ D_INTERVALL=$(cat $D_FILE_INTERVALL 2>/dev/null) # Look for pre-exec command (general) # if [ -x "$CPREEXEC" ]; then + echo "Executing $CPREEXEC ..." "$CPREEXEC" + echo "Finished ${CPREEXEC}." fi # @@ -268,7 +269,9 @@ while [ "$i" -lt "$no_shares" ]; do # pre_exec # if [ -x "$c_pre_exec" ]; then - "$pre_exec" + echo "Executing $c_pre_exec ..." + $c_pre_exec + echo "Finished ${c_pre_exec}." fi # exclude @@ -356,11 +359,14 @@ while [ "$i" -lt "$no_shares" ]; do fi echo "Successfully finished backup." + # # post_exec # if [ -x "$c_post_exec" ]; then - "$post_exec" + echo "Executing $c_post_exec ..." + "$c_post_exec" + echo "Finished ${c_post_exec}." fi ) | add_name @@ -377,8 +383,10 @@ fi # # Look for post-exec command (general) # -if [ -x "$POSTEXEC" ]; then - "$POSTEXEC" +if [ -x "$CPOSTEXEC" ]; then + echo "Executing $CPOSTEXEC ..." + "$CPOSTEXEC" + echo "Finished ${CPOSTEXEC}." fi rm -f "$TMP" diff --git a/conf/sources/with_exec/destination b/conf/sources/with_exec/destination new file mode 120000 index 0000000..cad2309 --- /dev/null +++ b/conf/sources/with_exec/destination @@ -0,0 +1 @@ +/tmp \ No newline at end of file diff --git a/conf/sources/with_exec/post_exec b/conf/sources/with_exec/post_exec new file mode 100755 index 0000000..fb8e8e0 --- /dev/null +++ b/conf/sources/with_exec/post_exec @@ -0,0 +1,5 @@ +#!/bin/sh + +# Show whats free after + +df -h diff --git a/conf/sources/with_exec/pre_exec b/conf/sources/with_exec/pre_exec new file mode 100755 index 0000000..869e6d6 --- /dev/null +++ b/conf/sources/with_exec/pre_exec @@ -0,0 +1,5 @@ +#!/bin/sh + +# Show whats free before + +df -h diff --git a/conf/sources/with_exec/source b/conf/sources/with_exec/source new file mode 100644 index 0000000..c76e288 --- /dev/null +++ b/conf/sources/with_exec/source @@ -0,0 +1 @@ +/home/user/nico/oeffentlich/computer/projekte/ccollect-0.3/