aboutsummaryrefslogtreecommitdiffstats
path: root/main/fcgiwrap/fcgiwrap.initd
blob: 353e51f3932426fdbb3284430763beded6d547c8 (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
40
41
42
43
#!/sbin/openrc-run

name="fcgiwrap"
description="fcgiwrap cgi daemon"

command="/usr/bin/fcgiwrap"
command_background="yes"
user="fcgiwrap"
group="www-data"
: ${socket:=unix:/run/fcgiwrap/fcgiwrap.sock}

depend() {
	need net localmount
	after firewall
}

start_pre() {
	command_args="-c ${nproc:-$(nproc)} -s $socket"
	case "$socket" in
	unix:/*)
		local socket_path=${socket#unix:}
		checkpath --directory --mode 2775 --owner ${user}:${group} \
			${socket_path%/*}
		;;
	esac
}

start() {
	ebegin "Starting ${name}"
	start-stop-daemon --exec ${command} \
		--background \
		-u ${user} -g ${group} \
		--start -- ${command_args}
	eend $?
}

stop_post() {
	case "$socket" in
	unix:/*)
		rm -f "${socket#unix:}"
		;;
	esac
}