This file is indexed.

/etc/init.d/monotone is in monotone-server 1.1-9.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#! /bin/sh
#
# monotone     Monotone server init script.
#
# Author:      Matthew A. Nicholson <matt@matt-land.com>.
#
### BEGIN INIT INFO
# Provides: monotone
# Required-Start: $network $remote_fs
# Required-Stop: $network $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Monotone server.
# Description: Provides synchronization services of a monotone
#              repository via netsync.
### END INIT INFO

set -e

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DESC="Monotone Server"
NAME=monotone
EXECNAME=mtn
DAEMON=/usr/bin/$EXECNAME
PIDDIR=/var/run/$NAME
SCRIPTNAME=/etc/init.d/$NAME
MAINLOG=/var/log/$NAME/$EXECNAME.log
ERRORLOG=/var/log/$NAME/error.log

# defaults for /etc/default/monotone
START=1
ADDRESS=0.0.0.0
MTN_HOME=/var/lib/monotone
MTN_CONFDIR=/etc/monotone
MTN_KEYDIR=$MTN_HOME/keys
MTN_DB=$MTN_HOME/default.mtn

# Gracefully exit if the package has been removed.
test -x $DAEMON || exit 0

# Get the logging helpers.
. /lib/lsb/init-functions

# Read config file
if [ -r /etc/default/$NAME ]; then
	. /etc/default/$NAME
fi

PIDFILE=$PIDDIR/$EXECNAME.pid

# Function that starts the daemon.
d_start()
{
    if [ "$START" -ne 1 ]; then
	log_action_msg "$NAME configured in /etc/default/$NAME not to start"
        return 0
    fi

    log_daemon_msg "Starting $DESC" "$NAME"

    # If /var/run is created in tmpfs, it will be wiped of previous data
    if [ ! -d "$PIDDIR" ]; then
	mkdir -p "$PIDDIR" && chown monotone:monotone "$PIDDIR"
    fi

    if start-stop-daemon --start --quiet --oknodo --background \
        --pidfile $PIDFILE --exec $DAEMON --chuid monotone --chdir $MTN_HOME \
	-- \
        --confdir=$MTN_CONFDIR --db=$MTN_DB --no-standard-rcfiles \
	--pid-file=$PIDFILE --log=$MAINLOG --dump=$ERRORLOG --timestamps \
        --rcfile=$MTN_CONFDIR/serverrc --keydir=$MTN_KEYDIR --quiet \
        --bind=$ADDRESS serve

    then log_end_msg 0
    else log_end_msg 1
    fi
}

# Function that stops the daemon.
d_stop()
{
    if [ "$START" -ne 1 ]; then
        return 0
    fi

    log_daemon_msg "Stopping $DESC" "$NAME"
    if start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE \
        --name $EXECNAME --user monotone

    then
	rm -f $PIDFILE
	log_end_msg 0
    else
	log_end_msg 1
    fi
}

case "$1" in
    start)
	d_start
	;;
    stop)
	d_stop
	;;
    restart|force-reload)
	d_stop
	d_start
	;;
    status)
	status_of_proc $DAEMON mtn && exit 0 || exit $?
	;;
    *)
	echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
	exit 1
	;;
esac