]> git.pld-linux.org Git - packages/ceph.git/blob - cephctl
e60dec6b89a75556bcb1d2218908d8bc29ba3ef8
[packages/ceph.git] / cephctl
1 #! /bin/bash
2
3 ### BEGIN INIT INFO
4 # Provides:       ceph ceph-mon ceph-osd
5 # Required-Start: $network $remote_fs
6 # Required-Stop:  $network $remote_fs
7 # Should-Start: network-remotefs
8 # Should-Stop: network-remotefs
9 # Default-Start:  3 5
10 # Default-Stop:   0 1 2 6
11 # Short-Description: Ceph is a distributed object, and block, storage platform
12 # Description:    Ceph is a distributed object, block, and file storage platform
13 ### END INIT INFO
14
15 SYSTEMD_NO_WRAP=1 . /etc/rc.status
16 rc_reset
17
18 action=$1 ; shift
19 cluster="ceph"
20 config=$1 ; shift
21
22 # Shared variables by many actions
23 dir_mon="/var/lib/ceph/mon/"
24 dir_osd="/var/lib/ceph/osd/"
25 if test -d ${dir_mon} ; then
26 lmon=`ls ${dir_mon} | grep ${cluster}`
27 fi
28 if test -d ${dir_osd} ; then
29 losd=`ls ${dir_osd} | grep ${cluster}`
30 fi
31 prefix="${cluster}-"
32
33 if test -n "$config" ; then
34         systemctl "${action}" "ceph-mon@${config}.service"
35 else
36         case $action in
37     start | stop | status | enable | disable | restart | is-active | is-failed | show | kill | reset-failed  )
38         n=0
39         if test -n ${lmon} ; then
40             for s in ${lmon#=${prefix}} ; do
41                 systemctl "${action}" ceph-mon@${s#$prefix}.service
42                 rc_check
43                 ((++n))
44             done
45         fi
46         if test -n ${lmon} ; then
47             for s in ${losd#=${prefix}} ; do
48                 systemctl "${action}" ceph-osd@${s#$prefix}.service
49                 rc_check
50                 ((++n))
51             done
52         fi
53         if test $n -gt 0 ; then
54                         rc_status
55                 else
56                         rc_status -u
57                 fi
58     ;;
59         *)
60                 echo "Invalid paramter : $action"
61         echo "Valid paramters  : start | stop | status | enable | disable | restart | is-active | is-failed | show | kill | reset-failed"
62         ;;
63         esac
64 fi
65 rc_exit
66
This page took 0.031575 seconds and 2 git commands to generate.