blob: c667c6582911e34242a6da41e6adce8caec680ce (
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
|
#!/sbin/openrc-run
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
MJPG_STREAMER_PIDFILE="${MJPG_STREAMER_PIDFILE:-/var/run/${SVCNAME}.pid}"
MY_NAME=${SVCNAME//-/_}
MY_PLUGINS="/usr/lib/mjpg-streamer"
depend() {
use logger
}
checkconfig() {
local vars
[[ ${INPUT_PLUGIN} ]] || vars+=\ INPUT_PLUGIN
[[ ${OUTPUT_PLUGIN} ]] || vars+=\ OUTPUT_PLUGIN
[[ ${MJPG_STREAMER_USER} ]] || vars+=\ MJPG_STREAMER_USER
[[ ${MJPG_STREAMER_GROUP} ]] || vars+=\ MJPG_STREAMER_GROUP
vars="${vars# }"
if [[ ${vars} ]]; then
eerror "Required variables in /etc/conf.d/${SVCNAME} are not set:"
eerror " ${vars// /, }"
return 1
fi
return 0
}
start() {
checkconfig || return $?
ebegin "Starting ${SVCNAME}"
start-stop-daemon --start --exec /usr/bin/${MY_NAME} \
--user "${MJPG_STREAMER_USER}" \
--group "${MJPG_STREAMER_GROUP}" -w 100 -b -m \
--pidfile "${MJPG_STREAMER_PIDFILE}" \
-- -i "${MY_PLUGINS}/input_${INPUT_PLUGIN}.so ${INPUT_PLUGIN_OPTS}" \
-o "${MY_PLUGINS}/output_${OUTPUT_PLUGIN}.so ${OUTPUT_PLUGIN_OPTS}"
eend $? "Check syslog to see why startup failed."
}
stop() {
ebegin "Stopping ${SVCNAME}"
start-stop-daemon --stop --exec /usr/bin/${MY_NAME} \
--pidfile "${MJPG_STREAMER_PIDFILE}"
eend $?
}
|