File: mini-buildd.init

package info (click to toggle)
mini-buildd 2.4.7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,632 kB
  • sloc: python: 9,994; sql: 1,597; sh: 1,466; javascript: 98; lisp: 90; cpp: 70; makefile: 69
file content (42 lines) | stat: -rwxr-xr-x 1,163 bytes parent folder | download | duplicates (2)
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
#!/lib/init/init-d-script
### BEGIN INIT INFO
# Provides:          mini-buildd
# Required-Start:    $remote_fs
# Required-Stop:     $remote_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: mini-buildd
# Description:       mini-buildd (custom Debian build daemon)
### END INIT INFO

LOGFILE="/var/log/mini-buildd.log"
DEFAULT_FILE="/etc/default/mini-buildd"
MINI_BUILDD_OPTIONS=""
if [ -e "${DEFAULT_FILE}" ]; then
	. "${DEFAULT_FILE}"
fi
export PYTHONWARNINGS

DAEMON=/usr/sbin/mini-buildd
DAEMON_ARGS="${MINI_BUILDD_OPTIONS}"
PIDFILE="/run/mini-buildd.pid"
GENERIC_ARGS="--quiet --pidfile ${PIDFILE} --user mini-buildd"

do_start_cmd()
{
	if [ -e "${PIDFILE}" ]; then
		printf "(already running)"
	else
		start-stop-daemon --start ${GENERIC_ARGS} --exec ${DAEMON} --make-pidfile --background --chuid mini-buildd --output "${LOGFILE}" -- ${MINI_BUILDD_OPTIONS}
	fi
}

# Default always want to add --exec, which does not work for (python) scripts
do_stop_cmd()
{
	if [ -e "${PIDFILE}" ]; then
		start-stop-daemon --stop ${GENERIC_ARGS} --retry=TERM/0/CONT/30/KILL/5 --remove-pidfile --oknodo
	else
		printf "(already stopped)"
	fi
}