summaryrefslogtreecommitdiff
path: root/media-video/srs/files/init.d
blob: 5358e3b9f9d16e2f5b080dbe8be3e975664dfc78 (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
44
45
46
47
48
49
50
51
52
53
#!/sbin/openrc-run
# Copyright 2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

description="SRS (Simple Realtime Server) media streaming server"

extra_started_commands="reload rotate grace"

description_reload="Reload SRS configuration smoothly using SIGHUP"
description_rotate="Reopen log files for logrotate using SIGUSR1"
description_grace="Gracefully quit SRS using SIGQUIT"

depend() {
	need net
	after firewall
}

start() {
	ebegin "Starting SRS"
	
	start-stop-daemon --start \
		--exec /usr/bin/srs-media \
		--pidfile "${SRS_PIDFILE:-/run/srs.pid}" \
		${SRS_EXTRA_OPTS} \
		-- -c "${SRS_CONFIG:-/etc/srs/srs.conf}"
	eend $?
}

stop() {
	ebegin "Stopping SRS"
	start-stop-daemon --stop \
		--retry SIGTERM/30/SIGKILL/5 \
		--pidfile "${SRS_PIDFILE:-/run/srs.pid}"
	eend $?
}

reload() {
	ebegin "Reloading SRS configuration"
	start-stop-daemon --signal SIGHUP --pidfile "${SRS_PIDFILE:-/run/srs.pid}"
	eend $?
}

rotate() {
	ebegin "Reopening SRS log files"
	start-stop-daemon --signal SIGUSR1 --pidfile "${SRS_PIDFILE:-/run/srs.pid}"
	eend $?
}

grace() {
	ebegin "Gracefully quitting SRS"
	start-stop-daemon --signal SIGQUIT --pidfile "${SRS_PIDFILE:-/run/srs.pid}"
	eend $?
}