Initial argv support
This commit is contained in:
parent
9b06628bb5
commit
64a81656c3
1 changed files with 43 additions and 4 deletions
47
ccollect.sh
47
ccollect.sh
|
@ -9,11 +9,50 @@ CCOLLECT_CONF=$HOME/crsnapshot/conf
|
||||||
CCOLLECT_CONF=${CCOLLECT_CONF:-/etc/ccollect}
|
CCOLLECT_CONF=${CCOLLECT_CONF:-/etc/ccollect}
|
||||||
|
|
||||||
#
|
#
|
||||||
# ARGV:
|
# Tell how to use us
|
||||||
# -s|--silent
|
|
||||||
# -p|--parallel
|
|
||||||
# -v|--verbose
|
|
||||||
#
|
#
|
||||||
|
usage()
|
||||||
|
{
|
||||||
|
echo "$(basename $0): [args] <shares to backup>"
|
||||||
|
echo ""
|
||||||
|
echo " Nico Schottelius (nico-linux-ccollect schottelius.org) - 2005-12-06"
|
||||||
|
echo ""
|
||||||
|
echo " Backup data pseudo incremental"
|
||||||
|
echo ""
|
||||||
|
echo " -h, --help: Show this help screen"
|
||||||
|
echo " -p, --parallel: Parellize backup process"
|
||||||
|
echo ""
|
||||||
|
echo " http://linux.schottelius.org/ccollect/"
|
||||||
|
echo ""
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Filter arguments
|
||||||
|
#
|
||||||
|
i=1
|
||||||
|
no_shares=0
|
||||||
|
|
||||||
|
while [ $i -le $# ]; do
|
||||||
|
eval arg=\$$i
|
||||||
|
|
||||||
|
case $arg in
|
||||||
|
-h|--help)
|
||||||
|
usage
|
||||||
|
;;
|
||||||
|
--)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
eval share_${no_shares}="$arg"
|
||||||
|
no_shares=$((no_shares+1))
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
i=$((i+1))
|
||||||
|
done
|
||||||
|
|
||||||
|
exit 1
|
||||||
|
|
||||||
if [ -z "$(ls $CCOLLECT_CONF 2>/dev/null)" ]; then
|
if [ -z "$(ls $CCOLLECT_CONF 2>/dev/null)" ]; then
|
||||||
echo "Aborting, nothing specified to backup in $CCOLLECT_CONF"
|
echo "Aborting, nothing specified to backup in $CCOLLECT_CONF"
|
||||||
|
|
Loading…
Reference in a new issue