Make -v work with the status command

- Also document exit status

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2013-08-13 06:52:46 -07:00
parent 84e0c98c88
commit 32763e998b
6 changed files with 69 additions and 16 deletions

View File

@ -2881,10 +2881,10 @@ report_capabilities1() {
show_status() { show_status() {
if product_is_started ; then if product_is_started ; then
echo "$g_product is running" [ $VERBOSITY -ge 1 ] && echo "$g_product is running"
status=0 status=0
else else
echo "$g_product is stopped" [ $VERBOSITY -ge 1 ] && echo "$g_product is stopped"
status=4 status=4
fi fi
@ -2898,14 +2898,13 @@ show_status() {
else else
state=Unknown state=Unknown
fi fi
echo "State:$state" [ $VERBOSITY -ge 1 ] && echo "State:$state"
} }
status_command() { status_command() {
echo "${g_product}-$SHOREWALL_VERSION Status at $g_hostname - $(date)" [ $VERBOSITY -ge 1 ] && echo "${g_product}-$SHOREWALL_VERSION Status at $g_hostname - $(date)" && echo
echo
show_status show_status
echo [ $VERBOSITY -ge 1 ] && echo
exit $status exit $status
} }

View File

@ -1086,6 +1086,23 @@
</variablelist> </variablelist>
</refsect1> </refsect1>
<refsect1>
<title>EXIT STATUS</title>
<para>In general, when a command succeeds, status 0 is returned; when the
command fails, a non-zero status is returned.</para>
<para>The <command>status</command> command returns exit status as
follows:</para>
<para>0 - Firewall is started.</para>
<para>3 - Firewall is stopped or cleared</para>
<para>4 - Unknown state; usually means that the firewall has never been
started.</para>
</refsect1>
<refsect1> <refsect1>
<title>FILES</title> <title>FILES</title>

View File

@ -321,13 +321,12 @@ case "$COMMAND" in
;; ;;
status) status)
[ $# -ne 1 ] && usage 2 [ $# -ne 1 ] && usage 2
echo "$g_product-$SHOREWALL_VERSION Status at $(hostname) - $(date)" [ $VERBOSITY -ge 1 ] && echo "$g_product-$SHOREWALL_VERSION Status at $(hostname) - $(date)" && echo
echo
if product_is_started; then if product_is_started; then
echo "$g_product is running" [ $VERBOSITY -ge 1 ] && echo "$g_product is running"
status=0 status=0
else else
echo "$g_product is stopped" [ $VERBOSITY -ge 1 ] && echo "$g_product is stopped"
status=4 status=4
fi fi
@ -341,8 +340,7 @@ case "$COMMAND" in
else else
state=Unknown state=Unknown
fi fi
echo "State:$state" [ $VERBOSITY -ge 1 ] && echo "State:$state" && echo
echo
;; ;;
up|down) up|down)
[ $# -eq 1 ] && exit 0 [ $# -eq 1 ] && exit 0

View File

@ -1793,6 +1793,23 @@
</variablelist> </variablelist>
</refsect1> </refsect1>
<refsect1>
<title>EXIT STATUS</title>
<para>In general, when a command succeeds, status 0 is returned; when the
command fails, a non-zero status is returned.</para>
<para>The <command>status</command> command returns exit status as
follows:</para>
<para>0 - Firewall is started.</para>
<para>3 - Firewall is stopped or cleared</para>
<para>4 - Unknown state; usually means that the firewall has never been
started.</para>
</refsect1>
<refsect1> <refsect1>
<title>FILES</title> <title>FILES</title>

View File

@ -1085,9 +1085,20 @@
</refsect1> </refsect1>
<refsect1> <refsect1>
<title>FILES</title> <title>EXIT STATUS</title>
<para>/etc/shorewall6-lite/</para> <para>In general, when a command succeeds, status 0 is returned; when the
command fails, a non-zero status is returned.</para>
<para>The <command>status</command> command returns exit status as
follows:</para>
<para>0 - Firewall is started.</para>
<para>3 - Firewall is stopped or cleared</para>
<para>4 - Unknown state; usually means that the firewall has never been
started.</para>
</refsect1> </refsect1>
<refsect1> <refsect1>

View File

@ -1630,9 +1630,20 @@
</refsect1> </refsect1>
<refsect1> <refsect1>
<title>FILES</title> <title>EXIT STATUS</title>
<para>/etc/shorewall6/</para> <para>In general, when a command succeeds, status 0 is returned; when the
command fails, a non-zero status is returned.</para>
<para>The <command>status</command> command returns exit status as
follows:</para>
<para>0 - Firewall is started.</para>
<para>3 - Firewall is stopped or cleared</para>
<para>4 - Unknown state; usually means that the firewall has never been
started.</para>
</refsect1> </refsect1>
<refsect1> <refsect1>