]> git.pld-linux.org Git - packages/ceph.git/blob - cephctl
'cephtctl' scrip ported to PLD
[packages/ceph.git] / cephctl
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 action=$1 ; shift
7 [ -f /etc/sysconfig/ceph ] && . /etc/sysconfig/ceph
8 cluster=${CLUSTER:-ceph}
9 config=$1 ; shift
10
11 # Shared variables by many actions
12 dir_mon="/var/lib/ceph/mon/"
13 dir_osd="/var/lib/ceph/osd/"
14 if test -d ${dir_mon} ; then
15 lmon=`ls ${dir_mon} | grep ${cluster}`
16 fi
17 if test -d ${dir_osd} ; then
18 losd=`ls ${dir_osd} | grep ${cluster}`
19 fi
20 prefix="${cluster}-"
21
22 RC=0
23
24 if test -n "$config" ; then
25         systemctl "${action}" "ceph-mon@${config}.service" || RC=1
26 else
27         case $action in
28     start | stop | status | enable | disable | restart | is-active | is-failed | show | kill | reset-failed  )
29         n=0
30         if test -n ${lmon} ; then
31             for s in ${lmon#=${prefix}} ; do
32                 systemctl "${action}" ceph-mon@${s#$prefix}.service
33                 [ $? -eq 0 ] || RC=1
34                 ((++n))
35             done
36         fi
37         if test -n ${lmon} ; then
38             for s in ${losd#=${prefix}} ; do
39                 systemctl "${action}" ceph-osd@${s#$prefix}.service
40                 [ $? -eq 0 ] || RC=1
41                 ((++n))
42             done
43         fi
44     ;;
45         *)
46                 echo "Invalid paramter : $action"
47         echo "Valid paramters  : start | stop | status | enable | disable | restart | is-active | is-failed | show | kill | reset-failed"
48         ;;
49         esac
50 fi
51 exit $RC
This page took 0.041285 seconds and 4 git commands to generate.