summaryrefslogtreecommitdiff
path: root/sys-cluster/ceph/files/ceph.initd-r2
blob: 16267c58a139dad7ef90bff8540259ddc3a2be36 (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
#!/sbin/openrc-run

ceph_conf="${ceph_conf:-/etc/ceph/ceph.conf}"
extra_commands="reload"
daemon_type="${RC_SVCNAME#ceph-}"
daemon_type="${daemon_type%.*}"
daemon_id="${RC_SVCNAME#ceph-*.}"
daemon_id="${daemon_id:-0}"
command="/usr/bin/ceph-${daemon_type}"
pidfile="/run/ceph/${daemon_type}.${daemon_id}.pid"
command_args="-i ${daemon_id} --pid-file ${pidfile} -c ${ceph_conf}"
start_stop_daemon_args="--user ceph --group ceph"

depend() {
	after net ntpd ntp-client chronyd
	before netmount
}

is_type_valid() {
	case ${daemon_type} in
		mon|mds|osd) return 0;;
		*) return 1;;
	esac
}

start_pre() {
	checkpath -d -q -o ceph "$(dirname "${pidfile}")"
	if ! is_type_valid ;then
		eerror "Please give valid Ceph Server Type: mds, mon, osd"
		return 1
	fi
}

reload() {
	ebegin "Reloading Ceph ${daemon_type}.${daemon_id}"
	start-stop-daemon --signal 1 ${start_stop_daemon_args} --pidfile "${pidfile}"
	eend $?
}

# vim:ft=gentoo-init-d:ts=4:sts=4:sw=4:noet: