Include compile time and date in the output of 'shorewall status'

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2016-04-27 16:25:21 -07:00
parent 05a15c6f8b
commit 2a40012fc4
3 changed files with 32 additions and 1 deletions

View File

@ -3324,6 +3324,8 @@ report_capabilities1() {
} }
show_status() { show_status() {
local compiletime
if product_is_started ; then if product_is_started ; then
[ $VERBOSITY -ge 1 ] && echo "$g_product is running" [ $VERBOSITY -ge 1 ] && echo "$g_product is running"
status=0 status=0
@ -3345,7 +3347,16 @@ show_status() {
if [ $VERBOSITY -ge 1 ]; then if [ $VERBOSITY -ge 1 ]; then
if [ -f $g_firewall ]; then if [ -f $g_firewall ]; then
state="$state ($g_firewall compiled by Shorewall version $($g_firewall version))" compiletime=$($g_firewall date)
case $compiletime in
Usage*)
state="$state ($g_firewall compiled by Shorewall version $($g_firewall version))"
;;
*)
state="$state ($g_firewall compiled $compiletime by Shorewall version $($g_firewall version))"
;;
esac
fi fi
echo "State:$state" echo "State:$state"
echo echo

View File

@ -596,6 +596,17 @@ EOF
} }
#
# Generate date_command()
#
sub compile_date_command() {
my $date = localtime;
emit( "\ndate_command() {" ,
" echo $date" ,
"}" );
}
# #
# The Compiler. # The Compiler.
# #
@ -922,6 +933,10 @@ sub compiler {
# #
compile_updown; compile_updown;
# #
# Echo the compilation time and date
#
compile_date_command;
#
# Copy the footer to the script # Copy the footer to the script
# #
copy $globals{SHAREDIRPL} . 'prog.footer' unless $test; copy $globals{SHAREDIRPL} . 'prog.footer' unless $test;

View File

@ -25,6 +25,7 @@ usage() {
echo " savesets <file>" echo " savesets <file>"
echo " call <function> [ <parameter> ... ]" echo " call <function> [ <parameter> ... ]"
echo " version" echo " version"
echo " date"
echo echo
echo "Options are:" echo "Options are:"
echo echo
@ -469,6 +470,10 @@ case "$COMMAND" in
echo $SHOREWALL_VERSION echo $SHOREWALL_VERSION
status=0 status=0
;; ;;
date)
[ $# -ne 1 ] && usage 2
date_command
;;
help) help)
[ $# -ne 1 ] && usage 2 [ $# -ne 1 ] && usage 2
usage 0 usage 0