summaryrefslogtreecommitdiff
blob: b74fd28b969c1f56ea0be43e60c2a64777da9c65 (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
#!/sbin/openrc-run
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

depend() {
	use net
	need conmux-registry
}

checkconfig() {
	if [ ! -f ${CONMUX_CONFIG} ]; then
		eerror ""
		eerror "No conmux configuration file was found!"
		eerror "Please read the conmux README file."
		eerror ""
		return 1
	fi
	# Sane default
	if [ -z ${CONMUX_LOG} ]; then
		CONMUX_LOG="/var/log/conmux.log"
	fi
	return 0
}

start() {
	checkconfig || exit 1
	# Make sure conmux finds everything
	export PATH="${PATH}:/usr/share/conmux/drivers:/usr/share/conmux/helpers"
	ebegin "Starting conmux daemon"
	start-stop-daemon -m -b --start -1 ${CONMUX_LOG} \
		-2 ${CONMUX_LOG} -p /run/${SVCNAME}.pid \
		--exec /usr/sbin/conmux -- ${CONMUX_CONFIG}
}

stop() {
	ebegin "Stopping conmux daemon"
	start-stop-daemon --stop --pidfile /run/${SVCNAME}.pid
	eend $?
}