Added the --all flag and a temp-file
This commit is contained in:
parent
b8e0c70108
commit
634f4169b8
1 changed files with 21 additions and 15 deletions
36
ccollect.sh
36
ccollect.sh
|
@ -11,11 +11,17 @@
|
||||||
CCOLLECT_CONF=$HOME/crsnapshot/conf
|
CCOLLECT_CONF=$HOME/crsnapshot/conf
|
||||||
|
|
||||||
#
|
#
|
||||||
# where to find our configuration
|
# where to find our configuration and temporary file
|
||||||
#
|
#
|
||||||
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/
|
||||||
|
TMP=$(mktemp /tmp/$(basename $0).XXXXXX)
|
||||||
|
|
||||||
|
#
|
||||||
|
# catch signals
|
||||||
|
#
|
||||||
|
trap "rm -f \"$TMP\"" 1 2 15
|
||||||
|
|
||||||
#
|
#
|
||||||
# Tell how to use us
|
# Tell how to use us
|
||||||
|
@ -83,15 +89,19 @@ done
|
||||||
if [ "$ALL" = 1 ]; then
|
if [ "$ALL" = 1 ]; then
|
||||||
# reset everything specified before
|
# reset everything specified before
|
||||||
no_shares=0
|
no_shares=0
|
||||||
|
|
||||||
OLD_IFS=$IFS
|
#
|
||||||
export IFS=\\n
|
# get entries from sources
|
||||||
|
#
|
||||||
for tmp in $(cd $CSOURCES/; ls); do
|
cwd=$(pwd)
|
||||||
eval share_${no_shares}="$tmp"
|
cd $CSOURCES;
|
||||||
|
ls > "$TMP"
|
||||||
|
|
||||||
|
while read tmp; do
|
||||||
|
echo ${tmp}
|
||||||
|
eval share_${no_shares}=\"$tmp\"
|
||||||
no_shares=$((no_shares+1))
|
no_shares=$((no_shares+1))
|
||||||
echo \"-${tmp}-\"
|
done < "$TMP"
|
||||||
done
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -101,14 +111,8 @@ if [ "$no_shares" -lt 1 ]; then
|
||||||
usage
|
usage
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
exit 1
|
exit 1
|
||||||
|
|
||||||
if [ -z "$(ls $CCOLLECT_CONF 2>/dev/null)" ]; then
|
|
||||||
echo "Aborting, nothing specified to backup in $CCOLLECT_CONF"
|
|
||||||
exit 23
|
|
||||||
fi
|
|
||||||
|
|
||||||
for backup in $CCOLLECT_CONF/*; do
|
for backup in $CCOLLECT_CONF/*; do
|
||||||
#
|
#
|
||||||
# Standard locations
|
# Standard locations
|
||||||
|
@ -148,3 +152,5 @@ for backup in $CCOLLECT_CONF/*; do
|
||||||
fi
|
fi
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
|
rm -f "$TMP"
|
||||||
|
|
Loading…
Reference in a new issue