summaryrefslogtreecommitdiff
path: root/sys-cluster/open-mx/files/omxoed.initd
blob: 765842ed7f68b2df06b4e94fae8cb652c6e86992 (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
#!/sbin/openrc-run
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

depend() {
	need net
}

checksystem() {
	if [ -c /dev/open-mx ]; then
		einfo "Open-MX module already loaded"
		return 0
	else
		einfo "Checking if Open-MX module present"
		if [ "x$(modprobe -l  open-mx | grep open-mx)" == "x" ]; then
			eerror "open-mx not found!"
			return 1
		fi
	fi
}

start() {
	ebegin "Starting ${SVCNAME}"
	checksystem || return 1
	if [ ! -c /dev/open-mx ]; then
		ebegin "Loading open-mx module"
		modprobe -q open-mx
	fi
	start-stop-daemon --start --exec /usr/bin/omxoed \
	 	--background --make-pidfile \
	 	--pidfile /var/run/omeoed.pid
	eend $?
}

stop() {
	ebegin "Stopping ${SVCNAME}"
	start-stop-daemon --stop --exec /usr/bin/omxoed \
		--pidfile /var/run/omeoed.pid
	eend $?
}

status() {
	ebegin "Showing current active Open-MX peers"
	omx_info -q
}