4 # Required-Start: $local_fs $remote_fs
5 # Required-Stop: $local_fs $remote_fs
6 # Default-Start: 2 3 4 5
8 # Short-Description: Invirt development configuration
12 # Author: Invirt project <invirt@mit.edu>
17 DESC="the Invirt build daemon"
18 DAEMON="/usr/bin/$NAME"
19 PIDFILE="/var/run/$NAME.pid"
20 GEN_FILES=/srv/repository/conf/distributions
22 [ -x "$DAEMON" ] || exit 0
24 . /lib/init/std-init.sh
25 . /lib/init/gen-files.sh
30 # 0 if daemon has been started
31 # 1 if daemon was already running
32 # 2 if daemon could not be started
36 for d in db dists lists pool; do
37 dir="/srv/repository/$d"
39 chown -R repository:nogroup "$dir"
41 reprepro-env export || ret=2
43 invirt-build-conf || ret=2
45 if [ "$ret" = 0 ]; then
47 # 0 if daemon has been started
48 # 1 if daemon was already running
49 # 2 if daemon could not be started
50 log_daemon_msg "Starting $DESC" "$NAME"
51 if daemon --running -n $NAME; then
52 log_daemon_msg "$NAME is already running!"
55 daemon -r -O daemon.info -E daemon.err -n $NAME -U $DAEMON || return 2
63 # 0 if daemon has been stopped
64 # 1 if daemon was already stopped
65 # 2 if daemon could not be stopped
66 # other if a failure occurred
67 log_daemon_msg "Stopping $DESC" "$NAME"
68 daemon --stop -n $NAME
70 [ "$RETVAL" = 2 ] && return 2
71 # Many daemons don't delete their pidfiles when they exit.