[24100] in Source-Commits

home help back first fref pref prev next nref lref last post

/svn/athena r23704 - trunk/athena/bin/lert/debian

daemon@ATHENA.MIT.EDU (Evan Broder)
Thu Apr 2 23:15:25 2009

Date: Thu, 2 Apr 2009 23:15:15 -0400
From: Evan Broder <broder@MIT.EDU>
Message-Id: <200904030315.n333FFvr026917@drugstore.mit.edu>
To: source-commits@mit.edu
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Author: broder
Date: 2009-04-02 23:15:15 -0400 (Thu, 02 Apr 2009)
New Revision: 23704

Added:
   trunk/athena/bin/lert/debian/debathena-lert-server.init
Log:
Include init script for debathena-lert-server.


Added: trunk/athena/bin/lert/debian/debathena-lert-server.init
===================================================================
--- trunk/athena/bin/lert/debian/debathena-lert-server.init	2009-04-03 02:29:48 UTC (rev 23703)
+++ trunk/athena/bin/lert/debian/debathena-lert-server.init	2009-04-03 03:15:15 UTC (rev 23704)
@@ -0,0 +1,109 @@
+#! /bin/sh
+### BEGIN INIT INFO
+# Provides:          debathena-lert-server
+# Required-Start:    $local_fs $remote_fs
+# Required-Stop:     $local_fs $remote_fs
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: Athena Lert notification server
+# Description:       The lert server sends notifications from Athena Accounts
+#                    to you, such as your account being scheduled for deletion.
+### END INIT INFO
+
+# Author: Evan Broder <broder@mit.edu>
+
+# Do NOT "set -e"
+
+# PATH should only include /usr/* if it runs after the mountnfs.sh script
+PATH=/usr/sbin:/usr/bin:/sbin:/bin
+DESC="Athena Lert notification server"
+NAME=lertsrv
+DAEMON=/usr/sbin/$NAME
+PIDFILE=/var/run/$NAME.pid
+SCRIPTNAME=/etc/init.d/$NAME
+
+# Exit if the package is not installed
+[ -x "$DAEMON" ] || exit 0
+
+# Load the VERBOSE setting and other rcS variables
+[ -f /etc/default/rcS ] && . /etc/default/rcS
+
+# Define LSB log_* functions.
+# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
+. /lib/lsb/init-functions
+
+#
+# Function that starts the daemon/service
+#
+do_start()
+{
+    # Return
+    #   0 if daemon has been started
+    #   1 if daemon was already running
+    #   2 if daemon could not be started
+    start-stop-daemon --stop --quiet --pidfile "$PIDFILE" --test --oknodo || return 1
+    start-stop-daemon --start --quiet --pidfile "$PIDFILE" \
+        --make-pidfile --background \
+        --exec "$DAEMON" || return 2
+}
+
+#
+# Function that stops the daemon/service
+#
+do_stop()
+{
+    # Return
+    #   0 if daemon has been stopped
+    #   1 if daemon was already stopped
+    #   2 if daemon could not be stopped
+    #   other if a failure occurred
+    start-stop-daemon --stop --quiet --pidfile "$PIDFILE"
+    RETVAL="$?"
+    [ "$RETVAL" = 2 ] && return 2
+    # Many daemons don't delete their pidfiles when they exit
+    rm -f "$PIDFILE"
+    return "$RETVAL"
+}
+
+case "$1" in
+  start)
+	[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
+	do_start
+	case "$?" in
+		0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+		2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+	esac
+	;;
+  stop)
+	[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
+	do_stop
+	case "$?" in
+		0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
+		2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
+	esac
+	;;
+  restart|force-reload)
+	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
+	;;
+  *)
+	echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
+	exit 3
+	;;
+esac
+
+:


Property changes on: trunk/athena/bin/lert/debian/debathena-lert-server.init
___________________________________________________________________
Name: svn:executable
   + *


home help back first fref pref prev next nref lref last post