aboutsummaryrefslogtreecommitdiffstats
path: root/testing/noprs/noprs.initd
blob: 3f3332f601734442afa7d90d564624a81676e317 (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
#!/sbin/openrc-run

name="$SVCNAME"
command="/usr/bin/noprs"
command_user="$SVCNAME"
command_args="$NOPRS_OPTS '$COMMENT_FILE'"
command_background="yes"
pidfile="/var/run/$SVCNAME.pid"
error_log="/var/log/noprs.log"

depend() {
	use net
}

start_pre() {
	[ -e "$COMMENT_FILE" ] || \
		eerror "File '$COMMENT_FILE' does not exist"

	export GITHUB_ACCESS_TOKEN GITHUB_WEBHOOK_SECRET
	[ -z "$GITHUB_ACCESS_TOKEN" -o -z "$GITHUB_WEBHOOK_SECRET" ] && \
		eerror "Access token and/or webhook secret not configured."

	# Create log file for unprivileged user
	checkpath --owner "${command_user}:${command_user}" \
		-f --mode 0644 "${error_log}"
}