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 case $COMMAND in
stop|clear|restore) stop|close|clear|restore)
;; ;;
*) *)
set +x set +x
@ -2445,13 +2445,18 @@ EOF
} }
emit ' 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 case $COMMAND in
stop|clear) 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 # The firewall is being stopped when we were trying to do something

View File

@ -5,7 +5,7 @@
# Give Usage Information # Give Usage Information
# #
usage() { 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
echo "Options are:" echo "Options are:"
echo echo
@ -182,6 +182,15 @@ case "$COMMAND" in
[ -n "$SUBSYSLOCK" ] && rm -f $SUBSYSLOCK [ -n "$SUBSYSLOCK" ] && rm -f $SUBSYSLOCK
progress_message3 "done." 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) reset)
if ! shorewall_is_started ; then if ! shorewall_is_started ; then
error_message "$g_product is not running" error_message "$g_product is not running"
@ -255,7 +264,10 @@ case "$COMMAND" in
progress_message3 "Clearing $g_product...." progress_message3 "Clearing $g_product...."
clear_firewall clear_firewall
status=0 status=0
[ -n "$SUBSYSLOCK" ] && rm -f $SUBSYSLOCK if [ -n "$SUBSYSLOCK" ]; then
rm -f ${SUBSYSLOCK}-prenet
rm -f $SUBSYSLOCK
fi
progress_message3 "done." progress_message3 "done."
;; ;;
status) status)

View File

@ -5,7 +5,7 @@
# Give Usage Information # Give Usage Information
# #
usage() { 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
echo "Options are:" echo "Options are:"
echo echo
@ -184,7 +184,16 @@ else
[ -n "$SUBSYSLOCK" ] && rm -f $SUBSYSLOCK [ -n "$SUBSYSLOCK" ] && rm -f $SUBSYSLOCK
progress_message3 "done." 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 if ! shorewall6_is_started ; then
error_message "$g_product is not running" error_message "$g_product is not running"
status=2 status=2
@ -256,7 +265,10 @@ else
progress_message3 "Clearing $g_product...." progress_message3 "Clearing $g_product...."
clear_firewall clear_firewall
status=0 status=0
[ -n "$SUBSYSLOCK" ] && rm -f $SUBSYSLOCK if [ -n "$SUBSYSLOCK" ]; then
rm -f ${SUBSYSLOCK}-prenet
rm -f $SUBSYSLOCK
fi
progress_message3 "done." progress_message3 "done."
;; ;;
status) status)