Implement 'close' command

This commit is contained in:
Tom Eastep 2010-05-10 17:13:32 -07:00
parent 3a00254594
commit 449ca038ba
3 changed files with 37 additions and 8 deletions

View File

@ -2240,7 +2240,7 @@ EOF
}
case $COMMAND in
stop|clear|restore)
stop|close|clear|restore)
;;
*)
set +x
@ -2445,13 +2445,18 @@ EOF
}
emit '
set_state "Stopped"
logger -p kern.info "$g_product Stopped"
if [ "$COMMAND" != close ]; then
set_state "Stopped"
logger -p kern.info "$g_product Stopped"
fi
case $COMMAND in
stop|clear)
;;
close)
set_state "Closed"
logger -p kern.info "$g_product Closed"
*)
#
# The firewall is being stopped when we were trying to do something

View File

@ -5,7 +5,7 @@
# Give Usage Information
#
usage() {
echo "Usage: $0 [ options ] [ start|stop|clear|reset|refresh|restart|status|version ]"
echo "Usage: $0 [ options ] [ start|stop|close|clear|reset|refresh|restart|status|version ]"
echo
echo "Options are:"
echo
@ -182,6 +182,15 @@ case "$COMMAND" in
[ -n "$SUBSYSLOCK" ] && rm -f $SUBSYSLOCK
progress_message3 "done."
;;
close)
[ $# -ne 1 ] && usage 2
progress_message3 "Closing $g_product...."
detect_configuration
stop_firewall
status=0
[ -n "$SUBSYSLOCK" ] && touch ${SUBSYSLOCK}-prenet
progress_message3 "done."
;;
reset)
if ! shorewall_is_started ; then
error_message "$g_product is not running"
@ -255,7 +264,10 @@ case "$COMMAND" in
progress_message3 "Clearing $g_product...."
clear_firewall
status=0
[ -n "$SUBSYSLOCK" ] && rm -f $SUBSYSLOCK
if [ -n "$SUBSYSLOCK" ]; then
rm -f ${SUBSYSLOCK}-prenet
rm -f $SUBSYSLOCK
fi
progress_message3 "done."
;;
status)

View File

@ -5,7 +5,7 @@
# Give Usage Information
#
usage() {
echo "Usage: $0 [ options ] [ start|stop|clear|reset|refresh|restart|status|version ]"
echo "Usage: $0 [ options ] [ start|stop|close|clear|reset|refresh|restart|status|version ]"
echo
echo "Options are:"
echo
@ -184,7 +184,16 @@ else
[ -n "$SUBSYSLOCK" ] && rm -f $SUBSYSLOCK
progress_message3 "done."
;;
reset)
close)
[ $# -ne 1 ] && usage 2
progress_message3 "Closing $g_product...."
detect_configuration
stop_firewall
status=0
[ -n "$SUBSYSLOCK" ] && touch ${SUBSYSLOCK}-prenet
progress_message3 "done."
;;
reset)
if ! shorewall6_is_started ; then
error_message "$g_product is not running"
status=2
@ -256,7 +265,10 @@ else
progress_message3 "Clearing $g_product...."
clear_firewall
status=0
[ -n "$SUBSYSLOCK" ] && rm -f $SUBSYSLOCK
if [ -n "$SUBSYSLOCK" ]; then
rm -f ${SUBSYSLOCK}-prenet
rm -f $SUBSYSLOCK
fi
progress_message3 "done."
;;
status)