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 shorewall status
Displays the Shorewall status (running/not-running)." Displays the Shorewall status (running/not-running).
;;
state) Also displays the Shorewall state as shown in the state diagram at
echo "state: state http://www.shorewall.net/starting_and_stopping_shorewall. The time and
date when that state was reached is also displayed."
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."
;; ;;
trace) trace)

View File

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

View File

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