diff options
Diffstat (limited to 'debian')
-rw-r--r-- | debian/changelog | 12 | ||||
-rw-r--r-- | debian/control | 1 | ||||
-rw-r--r-- | debian/mauvealert-server.init | 134 |
3 files changed, 98 insertions, 49 deletions
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 |