[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Monotone-devel] Debian init scripts for monotone
From: |
Matthew A. Nicholson |
Subject: |
[Monotone-devel] Debian init scripts for monotone |
Date: |
Tue, 29 Mar 2005 12:24:19 -0600 |
User-agent: |
Debian Thunderbird 1.0 (X11/20050116) |
Here is a patch that adds init scripts and instructions on how to use them to
the debian package. This way you can configure monotone via
/etc/default/monotone and start it either automatically or via:
/etc/init.d/monotone start
Let me know if there are any issues with these scripts that I missed.
--
Matthew A. Nicholson
Digium
diff -ruN monotone-0.17/debian/monotone.default
monotone-0.17.new/debian/monotone.default
--- monotone-0.17/debian/monotone.default 1969-12-31 18:00:00.000000000
-0600
+++ monotone-0.17.new/debian/monotone.default 2005-03-29 12:21:19.423818848
-0600
@@ -0,0 +1,17 @@
+# init.d config file for monotone
+
+# this must be set to 1 for monotone to start
+START=0
+
+# the address and or port (ADDRESS[:PORT]) monotone should listen on
+ADDRESS=localhost
+
+# the database to use
+DB=/usr/src/monotone.db
+
+# Collections that monotone should serve (seperated by white space)
+COLLECTIONS="com.collection \
+ com.collection.branch \
+ collection.com \
+ collection.com/branch"
+
diff -ruN monotone-0.17/debian/monotone.init
monotone-0.17.new/debian/monotone.init
--- monotone-0.17/debian/monotone.init 1969-12-31 18:00:00.000000000 -0600
+++ monotone-0.17.new/debian/monotone.init 2005-03-29 12:14:58.628708504
-0600
@@ -0,0 +1,108 @@
+#! /bin/sh
+#
+# monotone Monotone server init script.
+#
+# Author: Matthew A. Nicholson <address@hidden>.
+#
+# Version: v0.0.1 March 29, 2005 address@hidden
+#
+### BEGIN INIT INFO
+# Provides: monotone
+# Required-Start: $network $local_fs
+# Required-Stop: $network $local_fs
+# Default-Start: 3 4 5
+# Default-Stop: 0 1 2 6
+# Short-Description: Monotone server.
+### END INIT INFO
+
+set -e
+
+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+DESC="digium monotone server"
+NAME=monotone
+DAEMON=/usr/bin/$NAME
+PIDFILE=/var/run/$NAME.pid
+SCRIPTNAME=/etc/init.d/$NAME
+
+# Gracefully exit if the package has been removed.
+test -x $DAEMON || exit 0
+
+# Read config file
+. /etc/default/$NAME
+
+test $START -eq 1 || (echo "Please configure the monotone server in the
/etc/default/monotone file." && exit 1)
+
+#
+# Function that starts the daemon/service.
+#
+d_start() {
+ start-stop-daemon --start --quiet --make-pidfile --background --pidfile
$PIDFILE \
+ --exec $DAEMON -- --db=$DB --quiet serve $ADDRESS $COLLECTIONS
#&> /var/log/monotone.log
+
+}
+
+#
+# Function that stops the daemon/service.
+#
+d_stop() {
+ start-stop-daemon --stop --quiet --pidfile $PIDFILE \
+ --name $NAME
+
+
+# kill `ps x | grep monotone.*serve | grep -v grep | awk -- '{print
$1}'` &> /dev/null \
+# or echo "Failed: monotone not running"
+
+}
+
+#
+# Function that sends a SIGHUP to the daemon/service.
+#
+#d_reload() {
+# start-stop-daemon --stop --quiet --pidfile $PIDFILE \
+# --name $NAME --signal 1
+#}
+
+case "$1" in
+ start)
+ echo -n "Starting $DESC: $NAME"
+ d_start || echo -n ...failed
+ echo "."
+ ;;
+ stop)
+ echo -n "Stopping $DESC: $NAME"
+ d_stop || echo -n ...failed
+ echo "."
+ ;;
+ #reload)
+ #
+ # If the daemon can reload its configuration without
+ # restarting (for example, when it is sent a SIGHUP),
+ # then implement that here.
+ #
+ # If the daemon responds to changes in its config file
+ # directly anyway, make this an "exit 0".
+ #
+ # echo -n "Reloading $DESC configuration..."
+ # d_reload
+ # echo "done."
+ #;;
+ restart|force-reload)
+ #
+ # If the "reload" option is implemented, move the "force-reload"
+ # option to the "reload" entry above. If not, "force-reload" is
+ # just the same as "restart".
+ #
+ echo -n "Restarting $DESC: $NAME"
+ d_stop || echo "Not stopping... monotone not running."
+ sleep 1
+ d_start || echo "Error starting monotone"
+ echo "."
+ ;;
+ *)
+ # echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
+ echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
+ exit 1
+ ;;
+esac
+
+exit 0
diff -ruN monotone-0.17/debian/README.Debian
monotone-0.17.new/debian/README.Debian
--- monotone-0.17/debian/README.Debian 1969-12-31 18:00:00.000000000 -0600
+++ monotone-0.17.new/debian/README.Debian 2005-03-29 12:18:38.596268352
-0600
@@ -0,0 +1,15 @@
+monotone for Debian
+-------------------
+
+An init script for monotone has been included with this package. To use it you
+must edit /etc/default/monotone and install the proper links in your /etc/rc*.d
+directories as follows:
+
+update-rc.d monotone defaults
+
+This command should be run as root and will add the necessary startup links.
+You can also just start the monotone server manually:
+
+/etc/init.d/monotone start
+
+ -- Matthew A. Nicholson <address@hidden> Tue, 29 Mar 2005 12:11:07 -0600
diff -ruN monotone-0.17/debian/rules monotone-0.17.new/debian/rules
--- monotone-0.17/debian/rules 2005-03-19 03:56:39.000000000 -0600
+++ monotone-0.17.new/debian/rules 2005-03-29 12:01:04.778473008 -0600
@@ -86,7 +86,7 @@
# dh_installemacsen
# dh_installpam
# dh_installmime
-# dh_installinit
+ dh_installinit
# dh_installcron
# dh_installinfo
dh_installman