[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Monotone-devel] New improved Debian init scripts
From: |
Matthew A. Nicholson |
Subject: |
[Monotone-devel] New improved Debian init scripts |
Date: |
Tue, 12 Apr 2005 18:36:15 -0500 |
User-agent: |
Debian Thunderbird 1.0.2 (X11/20050331) |
Here are some new and improved debian init scripts. Still need to add debconf
functionality to make it retard proof, but experienced monotone users can eaisly
use this to set up a server in no time flat.
--
Matthew A. Nicholson
Digium
diff -uNr ../monotone-0.18/debian/monotone.default ./debian/monotone.default
--- ../monotone-0.18/debian/monotone.default 1969-12-31 18:00:00.000000000
-0600
+++ ./debian/monotone.default 2005-04-12 18:20:45.009865568 -0500
@@ -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=0.0.0.0
+
+# the database to use
+DB=/var/lib/monotone/default.db
+
+# Collections that monotone should serve (seperated by white space)
+COLLECTIONS="com.collection \
+ com.collection.branch \
+ collection.com \
+ collection.com/branch"
+
diff -uNr ../monotone-0.18/debian/monotone.init ./debian/monotone.init
--- ../monotone-0.18/debian/monotone.init 1969-12-31 18:00:00.000000000
-0600
+++ ./debian/monotone.init 2005-04-12 18:20:45.061857664 -0500
@@ -0,0 +1,111 @@
+#! /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="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 --pidfile $PIDFILE \
+ --exec $DAEMON -- --db=$DB --norc \
+ --rcfile=/etc/monotone/hooks.lua serve \
+ $ADDRESS $COLLECTIONS >> /var/log/monotone.log 2>&1 &
+
+}
+
+#
+# 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 "Stopping $DESC: $NAME"
+ d_stop || echo -n ...failed
+ echo "."
+ echo -n "Starting $DESC: $NAME"
+ d_start || echo -n ...failed
+ 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 -uNr ../monotone-0.18/debian/README.Debian ./debian/README.Debian
--- ../monotone-0.18/debian/README.Debian 1969-12-31 18:00:00.000000000
-0600
+++ ./debian/README.Debian 2005-04-12 18:21:37.713853344 -0500
@@ -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 -uNr ../monotone-0.18/debian/rules ./debian/rules
--- ../monotone-0.18/debian/rules 2005-04-11 04:41:14.000000000 -0500
+++ ./debian/rules 2005-04-12 18:20:45.122848392 -0500
@@ -86,7 +86,7 @@
# dh_installemacsen
# dh_installpam
# dh_installmime
-# dh_installinit
+ dh_installinit
# dh_installcron
# dh_installinfo
dh_installman
- [Monotone-devel] New improved Debian init scripts,
Matthew A. Nicholson <=