From a9a5474f7ca67fad57762ad63e6356346fd73c11 Mon Sep 17 00:00:00 2001 From: teastep Date: Wed, 9 Aug 2006 20:27:43 +0000 Subject: [PATCH] Re-implement 'try' command git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@4336 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb --- Shorewall/changelog.txt | 2 ++ Shorewall/releasenotes.txt | 11 +++++++++++ Shorewall/shorewall | 14 ++++++-------- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/Shorewall/changelog.txt b/Shorewall/changelog.txt index 98e4c0cf9..f66affdb3 100644 --- a/Shorewall/changelog.txt +++ b/Shorewall/changelog.txt @@ -14,6 +14,8 @@ Changes in 3.3.0 7) Merge shorewall.conf handling changes. +8) Re-implement the 'try' command. + diff --git a/Shorewall/releasenotes.txt b/Shorewall/releasenotes.txt index cddc43c2d..87ee1b502 100644 --- a/Shorewall/releasenotes.txt +++ b/Shorewall/releasenotes.txt @@ -42,6 +42,17 @@ Other changes in 3.3.0 removed. Please use ipsets to implement dynamic zones as described in http://www.shorewall.net/DynamicZones.html. +2) The 'try' command has been re-implemented. The command now does the + following: + + - shorewall save + - shorewall restart + - if the restart is not successful, the configuration is + automatically restored + - otherwise, if a timeout is given then + - sleep for the number of seconds specified and + - shorewall restore + Migration Considerations: 1) Support for dynamic zones (DYNAMIC_ZONES=Yes in shorewall.conf and diff --git a/Shorewall/shorewall b/Shorewall/shorewall index 47b1d5506..066284f72 100755 --- a/Shorewall/shorewall +++ b/Shorewall/shorewall @@ -1811,15 +1811,13 @@ case "$COMMAND" in VERBOSE=$(make_verbose) [ -n "$NOROUTES" ] && NOROUTES=-n export -n CONFIG_PATH - if ! $0 $debugging $VERBOSE -c $2 restart; then - if ! $IPTABLES -L shorewall > /dev/null 2> /dev/null; then - $0 $VERBOSE $NOROUTES start + if $0 $debugging $VERBOSE save; then + if $0 $debugging $VERBOSE restart $2 ; then + if [ $# -eq 3 ]; then + sleep $3 + $0 $VERBOSE $NOROUTES restore + fi fi - elif ! $IPTABLES -L shorewall > /dev/null 2> /dev/null; then - $0 $VERBOSE $NOROUTES start - elif [ $# -eq 3 ]; then - sleep $3 - $0 $VERBOSE $NOROUTES restart fi ;; logwatch)