Added full pre-/post exec implementation and configuration
This commit is contained in:
parent
3e32b84731
commit
97d9f2ff1a
5 changed files with 27 additions and 7 deletions
22
ccollect.sh
22
ccollect.sh
|
@ -68,19 +68,18 @@ fi
|
||||||
# check for configuraton directory
|
# check for configuraton directory
|
||||||
#
|
#
|
||||||
if [ ! -d "$CCOLLECT_CONF" ]; then
|
if [ ! -d "$CCOLLECT_CONF" ]; then
|
||||||
echo "Configuration \"$CCOLLECT_CONF\" not found."
|
echo "No configuration found in \"$CCOLLECT_CONF\"" \
|
||||||
|
" (set \$CCOLLECT_CONF corectly?)"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
# Filter arguments
|
# Filter arguments
|
||||||
#
|
#
|
||||||
|
|
||||||
INTERVALL=$1; shift
|
INTERVALL=$1; shift
|
||||||
i=1
|
i=1
|
||||||
no_shares=0
|
no_shares=0
|
||||||
|
|
||||||
set -x
|
|
||||||
while [ $i -le $# ]; do
|
while [ $i -le $# ]; do
|
||||||
eval arg=\$$i
|
eval arg=\$$i
|
||||||
|
|
||||||
|
@ -161,7 +160,9 @@ D_INTERVALL=$(cat $D_FILE_INTERVALL 2>/dev/null)
|
||||||
# Look for pre-exec command (general)
|
# Look for pre-exec command (general)
|
||||||
#
|
#
|
||||||
if [ -x "$CPREEXEC" ]; then
|
if [ -x "$CPREEXEC" ]; then
|
||||||
|
echo "Executing $CPREEXEC ..."
|
||||||
"$CPREEXEC"
|
"$CPREEXEC"
|
||||||
|
echo "Finished ${CPREEXEC}."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -268,7 +269,9 @@ while [ "$i" -lt "$no_shares" ]; do
|
||||||
# pre_exec
|
# pre_exec
|
||||||
#
|
#
|
||||||
if [ -x "$c_pre_exec" ]; then
|
if [ -x "$c_pre_exec" ]; then
|
||||||
"$pre_exec"
|
echo "Executing $c_pre_exec ..."
|
||||||
|
$c_pre_exec
|
||||||
|
echo "Finished ${c_pre_exec}."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# exclude
|
# exclude
|
||||||
|
@ -356,11 +359,14 @@ while [ "$i" -lt "$no_shares" ]; do
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Successfully finished backup."
|
echo "Successfully finished backup."
|
||||||
|
|
||||||
#
|
#
|
||||||
# post_exec
|
# post_exec
|
||||||
#
|
#
|
||||||
if [ -x "$c_post_exec" ]; then
|
if [ -x "$c_post_exec" ]; then
|
||||||
"$post_exec"
|
echo "Executing $c_post_exec ..."
|
||||||
|
"$c_post_exec"
|
||||||
|
echo "Finished ${c_post_exec}."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
) | add_name
|
) | add_name
|
||||||
|
@ -377,8 +383,10 @@ fi
|
||||||
#
|
#
|
||||||
# Look for post-exec command (general)
|
# Look for post-exec command (general)
|
||||||
#
|
#
|
||||||
if [ -x "$POSTEXEC" ]; then
|
if [ -x "$CPOSTEXEC" ]; then
|
||||||
"$POSTEXEC"
|
echo "Executing $CPOSTEXEC ..."
|
||||||
|
"$CPOSTEXEC"
|
||||||
|
echo "Finished ${CPOSTEXEC}."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -f "$TMP"
|
rm -f "$TMP"
|
||||||
|
|
1
conf/sources/with_exec/destination
Symbolic link
1
conf/sources/with_exec/destination
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
/tmp
|
5
conf/sources/with_exec/post_exec
Executable file
5
conf/sources/with_exec/post_exec
Executable file
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Show whats free after
|
||||||
|
|
||||||
|
df -h
|
5
conf/sources/with_exec/pre_exec
Executable file
5
conf/sources/with_exec/pre_exec
Executable file
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Show whats free before
|
||||||
|
|
||||||
|
df -h
|
1
conf/sources/with_exec/source
Normal file
1
conf/sources/with_exec/source
Normal file
|
@ -0,0 +1 @@
|
||||||
|
/home/user/nico/oeffentlich/computer/projekte/ccollect-0.3/
|
Loading…
Reference in a new issue