]>
Commit | Line | Data |
---|---|---|
1 | #! /bin/bash | |
2 | ||
3 | # It seems this was designed as /etc/init.d/ceph script for controlling the systemd | |
4 | # units on SuSE, made into 'cephctl' for PLD | |
5 | ||
6 | systemd_booted 2>/dev/null || exec /etc/rc.d/init.d/ceph "$@" | |
7 | ||
8 | action=$1 ; shift | |
9 | [ -f /etc/sysconfig/ceph ] && . /etc/sysconfig/ceph | |
10 | cluster=${CLUSTER:-ceph} | |
11 | config=$1 ; shift | |
12 | ||
13 | # Shared variables by many actions | |
14 | dir_mon="/var/lib/ceph/mon/" | |
15 | dir_osd="/var/lib/ceph/osd/" | |
16 | if test -d ${dir_mon} ; then | |
17 | lmon=`ls ${dir_mon} | grep ${cluster}` | |
18 | fi | |
19 | if test -d ${dir_osd} ; then | |
20 | losd=`ls ${dir_osd} | grep ${cluster}` | |
21 | fi | |
22 | prefix="${cluster}-" | |
23 | ||
24 | RC=0 | |
25 | ||
26 | if test -n "$config" ; then | |
27 | systemctl "${action}" "ceph-mon@${config}.service" || RC=1 | |
28 | else | |
29 | case $action in | |
30 | start | stop | status | enable | disable | restart | is-active | is-failed | show | kill | reset-failed | reload ) | |
31 | n=0 | |
32 | if test -n ${lmon} ; then | |
33 | for s in ${lmon#=${prefix}} ; do | |
34 | systemctl "${action}" ceph-mon@${s#$prefix}.service | |
35 | [ $? -eq 0 ] || RC=1 | |
36 | ((++n)) | |
37 | done | |
38 | fi | |
39 | if test -n ${lmon} ; then | |
40 | for s in ${losd#=${prefix}} ; do | |
41 | systemctl "${action}" ceph-osd@${s#$prefix}.service | |
42 | [ $? -eq 0 ] || RC=1 | |
43 | ((++n)) | |
44 | done | |
45 | fi | |
46 | ;; | |
47 | *) | |
48 | echo "Invalid paramter : $action" | |
49 | echo "Valid paramters : start | stop | status | enable | disable | restart | is-active | is-failed | show | kill | reset-failed | reload" | |
50 | ;; | |
51 | esac | |
52 | fi | |
53 | exit $RC |