Recombine the 'status' and 'state' commands

git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@2434 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
teastep 2005-07-30 21:59:12 +00:00
parent 303b01e254
commit b828793da9
3 changed files with 16 additions and 31 deletions

View File

@ -302,18 +302,11 @@ status)
shorewall status
Displays the Shorewall status (running/not-running)."
;;
Displays the Shorewall status (running/not-running).
state)
echo "state: state
shorewall state
Displays the Shorewall state as shown in the state diagram at
http://www.shorewall.net/starting_and_stopping_shorewall. If Shorewall
has been started since installed, the time at which Shorewall was last
started/restarted/refreshed or reset is displayed."
Also displays the Shorewall state as shown in the state diagram at
http://www.shorewall.net/starting_and_stopping_shorewall. The time and
date when that state was reached is also displayed."
;;
trace)

View File

@ -147,16 +147,14 @@ Migration Considerations:
7) The "shorewall status" command now just gives the status of
Shorewall (started or not-started). The previous status command has
been renamed "dump".
A new "state" command gives the Shorewall state relative to the
been renamed "dump". The command also shows the state relative to the
state diagram at
http://shorewall.net/starting_and_stopping_shorewall.htm. In
addition to the state, the time and date at which that state was
entered is shown.
Note that at least one "shorewall [re]start" must be issued after
upgrading to this release before "shorewall state" will show
upgrading to this release before "shorewall status" will show
anything but "Unknown" for the state.
New Features in Shorewall 2.5.0

View File

@ -42,7 +42,6 @@
# plus the last 20 "interesting"
# packets
# shorewall status Displays firewall status
# shorewall state Displays firewall state
# shorewall reset Resets iptables packet and
# byte counts
# shorewall clear Open the floodgates by
@ -521,7 +520,6 @@ usage() # $1 = exit status
echo " show [<chain> [ <chain> ... ]|actions|capabilities|classifiers|connections|log|nat|tc|tos|zones]"
echo " start [ <directory> ]"
echo " stop"
echo " state"
echo " status"
echo " try <directory> [ <timeout> ]"
echo " version"
@ -918,33 +916,29 @@ case "$1" in
;;
status)
[ $# -eq 1 ] || usage 1
echo "Shorewall-$version Status at $HOSTNAME - $(date)"
echo
if shorewall_is_started ; then
echo "Shorewall is running"
exit 0
fi
status=0
else
echo "Shorewall is stopped"
status=4
fi
if [ -f /var/lib/shorewall/state ]; then
case $(cat /var/lib/shorewall/state) in
state="$(cat /var/lib/shorewall/state)"
case $state in
Stopped*|Clear*)
status=3
;;
esac
fi
exit $status
;;
state)
[ $# -eq 1 ] || usage 1
echo "Shorewall-$version State at $HOSTNAME - $(date)"
echo
if [ -f /var/lib/shorewall/state ]; then
state=$(cat /var/lib/shorewall/state)
else
state=Unknown
fi
echo "The Shorewall state is $state"
echo "State:$state"
echo
exit $status
;;
dump)
[ -n "$debugging" ] && set -x