]> git.pld-linux.org Git - packages/ceph.git/blame - cephctl
- rel 2; fix build with new boost
[packages/ceph.git] / cephctl
CommitLineData
b6163d67
JK
1#! /bin/bash
2
8b205fd7
JK
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
b6163d67 5
dd6fa341
JK
6systemd_booted 2>/dev/null || exec /etc/rc.d/init.d/ceph "$@"
7
b6163d67 8action=$1 ; shift
8b205fd7
JK
9[ -f /etc/sysconfig/ceph ] && . /etc/sysconfig/ceph
10cluster=${CLUSTER:-ceph}
b6163d67
JK
11config=$1 ; shift
12
13# Shared variables by many actions
14dir_mon="/var/lib/ceph/mon/"
15dir_osd="/var/lib/ceph/osd/"
16if test -d ${dir_mon} ; then
17lmon=`ls ${dir_mon} | grep ${cluster}`
18fi
19if test -d ${dir_osd} ; then
20losd=`ls ${dir_osd} | grep ${cluster}`
21fi
22prefix="${cluster}-"
23
8b205fd7
JK
24RC=0
25
b6163d67 26if test -n "$config" ; then
8b205fd7 27 systemctl "${action}" "ceph-mon@${config}.service" || RC=1
b6163d67
JK
28else
29 case $action in
0bb0fd1a 30 start | stop | status | enable | disable | restart | is-active | is-failed | show | kill | reset-failed | reload )
b6163d67
JK
31 n=0
32 if test -n ${lmon} ; then
33 for s in ${lmon#=${prefix}} ; do
34 systemctl "${action}" ceph-mon@${s#$prefix}.service
8b205fd7 35 [ $? -eq 0 ] || RC=1
b6163d67
JK
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
8b205fd7 42 [ $? -eq 0 ] || RC=1
b6163d67
JK
43 ((++n))
44 done
45 fi
b6163d67
JK
46 ;;
47 *)
48 echo "Invalid paramter : $action"
0bb0fd1a 49 echo "Valid paramters : start | stop | status | enable | disable | restart | is-active | is-failed | show | kill | reset-failed | reload"
b6163d67
JK
50 ;;
51 esac
52fi
8b205fd7 53exit $RC
This page took 0.053898 seconds and 4 git commands to generate.