Move 'logwatch' processing to lib.cli

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@5020 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2006-11-29 01:11:29 +00:00
parent cd50bf9396
commit 08edd066c8
3 changed files with 60 additions and 106 deletions

View File

@ -640,58 +640,7 @@ case "$COMMAND" in
echo $version Lite
;;
logwatch)
shift
finished=0
while [ $finished -eq 0 -a $# -ne 0 ]; do
option=$1
case $option in
-*)
option=${option#-}
[ -z "$option" ] && usage 1
while [ -n "$option" ]; do
case $option in
v*)
VERBOSE=$(($VERBOSE + 1 ))
option=${option#v}
;;
q*)
VERBOSE=$(($VERBOSE - 1 ))
option=${option#q}
;;
m*)
SHOWMACS=Yes
option=${option#m}
;;
-)
finished=1
option=
;;
*)
usage 1
;;
esac
done
shift
;;
*)
finished=1
;;
esac
done
[ -n "$debugging" ] && set -x
if [ $# -eq 1 ]; then
logwatch $1
elif [ $# -eq 0 ]; then
logwatch 30
else
usage 1
fi
logwatch_command $@
;;
drop)
[ -n "$debugging" ] && set -x

View File

@ -930,3 +930,60 @@ allow_command() {
exit 2
fi
}
#
# 'logwatch' command executor
#
logwatch_command() {
shift
finished=0
while [ $finished -eq 0 -a $# -ne 0 ]; do
option=$1
case $option in
-*)
option=${option#-}
[ -z "$option" ] && usage 1
while [ -n "$option" ]; do
case $option in
v*)
VERBOSE=$(($VERBOSE + 1 ))
option=${option#v}
;;
q*)
VERBOSE=$(($VERBOSE - 1 ))
option=${option#q}
;;
m*)
SHOWMACS=Yes
option=${option#m}
;;
-)
finished=1
option=
;;
*)
usage 1
;;
esac
done
shift
;;
*)
finished=1
;;
esac
done
[ -n "$debugging" ] && set -x
if [ $# -eq 1 ]; then
logwatch $1
elif [ $# -eq 0 ]; then
logwatch 30
else
usage 1
fi
}

View File

@ -1209,64 +1209,12 @@ case "$COMMAND" in
fi
elif ! $IPTABLES -L shorewall > /dev/null 2> /dev/null; then
$0 $VERBOSE $NOROUTES start
elif [ $# -eq 3 ]; then
sleep $3
elif [ $# -eq 3 ]; the sleep $3
$0 $VERBOSE $NOROUTES restart
fi
;;
logwatch)
shift
finished=0
while [ $finished -eq 0 -a $# -ne 0 ]; do
option=$1
case $option in
-*)
option=${option#-}
[ -z "$option" ] && usage 1
while [ -n "$option" ]; do
case $option in
v*)
VERBOSE=$(($VERBOSE + 1 ))
option=${option#v}
;;
q*)
VERBOSE=$(($VERBOSE - 1 ))
option=${option#q}
;;
m*)
SHOWMACS=Yes
option=${option#m}
;;
-)
finished=1
option=
;;
*)
usage 1
;;
esac
done
shift
;;
*)
finished=1
;;
esac
done
[ -n "$debugging" ] && set -x
if [ $# -eq 1 ]; then
logwatch $1
elif [ $# -eq 0 ]; then
logwatch 30
else
usage 1
fi
logwatch_command $@
;;
drop)
[ -n "$debugging" ] && set -x