summaryrefslogtreecommitdiff
blob: ca5ab60cc0b795d2060a5f10ca1a6a6d2f93f240 (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/runscript

ceph_conf="${ceph_conf:-/etc/ceph/ceph.conf}"
extra_commands="reload"
type=${RC_SVCNAME:5:3}
id=${RC_SVCNAME:9}
id=${id:-"0"}
command="/usr/bin/ceph-${type}"
pidfile="/run/ceph/${type}.${id}.pid"
command_args="-i ${id} --pid-file ${pidfile} -c ${ceph_conf}"

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

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

start_pre() {
        checkpath -d -q $(dirname ${pidfile})
}

start() {
	ebegin "Starting Ceph ${type}.${id}"
	if ! is_type_valid ;then
		eerror "Please give valid Ceph Server Type: mds, mon, osd"
		return 1
	fi
	${command} ${command_args}
	eend $?
}

stop() {
	ebegin "Stopping Ceph ${type}.${id}"
	start-stop-daemon --stop --pidfile ${pidfile}
	eend $?
}

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