summaryrefslogtreecommitdiffstats
path: root/main/atheme-iris/atheme-iris.initd
blob: 4ac1708463486b6813687c81309afcdb9e0dcc10 (plain)
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
#!/sbin/runscript
# Copyright 2013 Alpine Linux 
# Distributed under the terms of the GNU General Public License v2

extra_stopped_commands="compile"

: ${SVCHOME:=/var/lib/$SVCNAME}
: ${pidfile:=/var/run/${SVCNAME%%.*}/${SVCNAME#*.}.pid}

depend() {
	use net
	need localmount
}
compile() {
	ebegin "Compiling configuration for ${SVCNAME}"
	cd ${SVCHOME}
	./clean.py
	./compile.py
	eend $?
}

start() {
	compile || return 1
	checkpath --directory --owner iris ${pidfile%/*}
	ebegin "Starting ${SVCNAME}"
	start-stop-daemon --exec ${SVCHOME}/run.py \
		--pidfile $pidfile \
		--chdir $SVCHOME \
		--user iris:iris \
		--background \
		--stdout /dev/null \
		--stderr /dev/null \
		--wait 500 \
		-- \
		-P $pidfile \
		$ARGS

	eend $?
}