diff options
-rw-r--r-- | .hgtags | 1 | ||||
-rw-r--r-- | debian/changelog | 12 | ||||
-rw-r--r-- | debian/control | 1 | ||||
-rw-r--r-- | debian/mauvealert-server.init | 134 | ||||
-rw-r--r-- | lib/mauve/processor.rb | 4 | ||||
-rw-r--r-- | lib/mauve/version.rb | 2 |
6 files changed, 102 insertions, 52 deletions
@@ -12,3 +12,4 @@ f8edd462e6123096d59f720c35334ca52e78b178 3.5.10 3014ac988310e93c713f43bd9f3dbfd5530928f7 3.6.0 1ce7089fb72d5f51812e441238cc21cf86a8ea7d 3.6.1 02870239eabb414b75e87df909071e1cfcdf6c26 3.6.2 +13c472f03673e350393ec6ff2611f9bda767b287 3.6.3 diff --git a/debian/changelog b/debian/changelog index c3b0e0d..39fcdbf 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,14 @@ -mauvealert (3.6.2) lucid; urgency=low +mauvealert (3.6.3) stable; urgency=low + + * Logs received at time in Processor + * Added lsb-base dependency + * Added test-task to init script + * Added include, include_file, and include_directory directives to + configuration. + + -- Patrick J Cherry <patrick@bytemark.co.uk> Fri, 06 Jan 2012 14:41:45 +0000 + +mauvealert (3.6.2) stable; urgency=low * Tinkered with dependencies diff --git a/debian/control b/debian/control index ea29d70..fcaa9a5 100644 --- a/debian/control +++ b/debian/control @@ -36,6 +36,7 @@ Depends: mauvealert-common (>= 3.4.0), librmail-ruby1.8, libsanitize-ruby1.8 (>= 2.0.3), libsinatra-ruby1.8 (>= 1.0), + lsb-base (>= 3.2-14), ruby1.8 (>= 1.8.7), thin1.8 (>= 1.2.11) | thin (>= 1.2.11), libxmpp4r-ruby1.8, diff --git a/debian/mauvealert-server.init b/debian/mauvealert-server.init index 592304f..71d287d 100644 --- a/debian/mauvealert-server.init +++ b/debian/mauvealert-server.init @@ -47,6 +47,7 @@ do_start() # 0 if daemon has been started # 1 if daemon was already running # 2 if daemon could not be started + do_test || return 2 start-stop-daemon --start --quiet --pidfile $PIDFILE --startas $DAEMON --chuid $RUNASUSER --test > /dev/null \ || return 1 @@ -119,69 +120,106 @@ do_reopenlogs() { } +# +# Test the config file before execution +# +do_test() { + # + # Make sure we're root + # + [ "$USER" = "root" ] || return 1 + + # + # OK test. + # + su $RUNASUSER -s /bin/bash -c "$DAEMON -t $DAEMON_ARGS" 1>/dev/null 2>&1 || return 1 + return 0 +} + case "$1" in start) - [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" - do_start - case "$?" in - 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 || exit 0 ;; - 2) [ "$VERBOSE" != no ] && log_end_msg 1 || exit 1 ;; - esac - ;; + [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" + do_start + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 || exit 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 || exit 1 ;; + esac + ;; + stop) - [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" - do_stop - case "$?" in - 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 || exit 0 ;; - 2) [ "$VERBOSE" != no ] && log_end_msg 1 || exit 1 ;; - esac - ;; - status) - status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? - ;; - reload|force-reload) + [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" + do_stop + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 || exit 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 || exit 1 ;; + esac + ;; + + status) + status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? + ;; + # # If do_reload() is not implemented then leave this commented out # and leave 'force-reload' as an alias for 'restart'. # - log_daemon_msg "Reloading $DESC" "$NAME" - do_reload - log_end_msg $? - ;; + reload|force-reload) + log_daemon_msg "Reloading $DESC" "$NAME" + do_reload + log_end_msg $? + ;; + # # This is for use by logrotate, as the post-rotate method. # reopen-logs) - log_daemon_msg "Re-opening logs for $DESC" "$NAME" - do_reopenlogs - log_end_msg $? - ;; - restart) + log_daemon_msg "Re-opening logs for $DESC" "$NAME" + do_reopenlogs + log_end_msg $? + ;; + + # + # This is to test the configuration + # + test|config-test) + log_daemon_msg "Testing configuration for $DESC" "$NAME" + do_test + log_end_msg $? + ;; + # # If the "reload" option is implemented then remove the # 'force-reload' alias # - log_daemon_msg "Restarting $DESC" "$NAME" - do_stop - case "$?" in - 0|1) - do_start - case "$?" in - 0) log_end_msg 0 ;; - 1) log_end_msg 1 ;; # Old process is still running - *) log_end_msg 1 ;; # Failed to start - esac - ;; - *) - # Failed to stop - log_end_msg 1 - ;; - esac - ;; + restart) + log_daemon_msg "Restarting $DESC" "$NAME" + + do_test + if [ "$?" != "0" ] ; then + log_end_msg 1 # test failed + fi + + do_stop + case "$?" in + 0|1) + do_start + case "$?" in + 0) log_end_msg 0 ;; + 1) log_end_msg 1 ;; # Old process is still running + *) log_end_msg 1 ;; # Failed to start + esac + ;; + *) + # Failed to stop + log_end_msg 1 + ;; + esac + ;; + *) - #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2 - echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2 - exit 3 - ;; + #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2 + echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload|test}" >&2 + exit 3 + ;; esac diff --git a/lib/mauve/processor.rb b/lib/mauve/processor.rb index 96c44aa..9896530 100644 --- a/lib/mauve/processor.rb +++ b/lib/mauve/processor.rb @@ -162,7 +162,7 @@ module Mauve # # Uh-oh. Nil data? That's craaaazy # - break if data.nil? + next if data.nil? # logger.debug("Got #{data.inspect} from #{client.inspect}") @@ -181,7 +181,7 @@ module Mauve next end - logger.debug "Update #{update.transmission_id} sent at #{update.transmission_time} from "+ + logger.debug "Update #{update.transmission_id} sent at #{update.transmission_time} received at #{received_at.to_i} from "+ "'#{update.source}'@#{ip_source} alerts #{update.alert.length}" Alert.receive_update(update, received_at, ip_source) diff --git a/lib/mauve/version.rb b/lib/mauve/version.rb index 312b9ae..d27b796 100644 --- a/lib/mauve/version.rb +++ b/lib/mauve/version.rb @@ -5,6 +5,6 @@ module Mauve # # Current version - VERSION="3.6.2" + VERSION="3.6.3" end |