summaryrefslogtreecommitdiff
blob: 9285f0d59a810387f698cfd86e142dfad1bb6cf6 (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

description="Gmqtt Broker Service"
pidfile=${pidfile:-"/run/${RC_SVCNAME}.pid"}
command="/usr/bin/gmqttd"
command_user="nobody:nobody"
command_args="${GMQTTD_OPTS=:-"-c /etc/gmqtt/gmqttd.yml start"}"
command_background="true"
logfile=/var/log/gmqtt/${RC_SVCNAME}.log
start_stop_daemon_args="--user ${command_user%:*} --group ${command_user#*:}
	--stdout ${logfile} --stderr ${logfile}"

: "${supervisor:=supervise-daemon}"
: "${respawn_delay:=5}"
: "${respawn_max:=10}"
: "${respawn_period:=60}"

depend() {
	need net
}

start() {
	checkpath --directory --mode 755 --owner root "${pidfile%/*}"
	checkpath --directory --mode 755 --owner "${command_user}" "${logfile%/*}"
	default_start
}