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
32
ccollect.sh
32
ccollect.sh
|
@ -11,11 +11,17 @@
|
|||
CCOLLECT_CONF=$HOME/crsnapshot/conf
|
||||
|
||||
#
|
||||
# where to find our configuration
|
||||
# where to find our configuration and temporary file
|
||||
#
|
||||
CCOLLECT_CONF=${CCOLLECT_CONF:-/etc/ccollect}
|
||||
CSOURCES=$CCOLLECT_CONF/sources/
|
||||
CDEFAULTS=$CCOLLECT_CONF/defaults/
|
||||
TMP=$(mktemp /tmp/$(basename $0).XXXXXX)
|
||||
|
||||
#
|
||||
# catch signals
|
||||
#
|
||||
trap "rm -f \"$TMP\"" 1 2 15
|
||||
|
||||
#
|
||||
# Tell how to use us
|
||||
|
@ -84,14 +90,18 @@ if [ "$ALL" = 1 ]; then
|
|||
# reset everything specified before
|
||||
no_shares=0
|
||||
|
||||
OLD_IFS=$IFS
|
||||
export IFS=\\n
|
||||
#
|
||||
# get entries from sources
|
||||
#
|
||||
cwd=$(pwd)
|
||||
cd $CSOURCES;
|
||||
ls > "$TMP"
|
||||
|
||||
for tmp in $(cd $CSOURCES/; ls); do
|
||||
eval share_${no_shares}="$tmp"
|
||||
while read tmp; do
|
||||
echo ${tmp}
|
||||
eval share_${no_shares}=\"$tmp\"
|
||||
no_shares=$((no_shares+1))
|
||||
echo \"-${tmp}-\"
|
||||
done
|
||||
done < "$TMP"
|
||||
fi
|
||||
|
||||
#
|
||||
|
@ -101,14 +111,8 @@ if [ "$no_shares" -lt 1 ]; then
|
|||
usage
|
||||
fi
|
||||
|
||||
|
||||
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
|
||||
#
|
||||
# Standard locations
|
||||
|
@ -148,3 +152,5 @@ for backup in $CCOLLECT_CONF/*; do
|
|||
fi
|
||||
|
||||
done
|
||||
|
||||
rm -f "$TMP"
|
||||
|
|
Loading…
Reference in a new issue