]> git.proxmox.com Git - ceph.git/blob - ceph/systemd/ceph
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / systemd / ceph
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
20 # default cluster name to "ceph"
21 cluster="ceph"
22
23 # Shared variables by many actions
24 dir_mon="/var/lib/ceph/mon/"
25 dir_osd="/var/lib/ceph/osd/"
26 if test -d ${dir_mon} ; then
27 lmon=`ls ${dir_mon} | grep ${cluster}`
28 fi
29 if test -d ${dir_osd} ; then
30 losd=`ls ${dir_osd} | grep ${cluster}`
31 fi
32 prefix="${cluster}-"
33
34 case $action in start | stop | status | enable | disable | mask | unmask | restart | is-active | is-failed | show | kill | reset-failed )
35 n=0
36 if test -n "${lmon}" ; then
37 for s in ${lmon#=${prefix}} ; do
38 systemctl "${action}" ceph-mon@${s#$prefix}.service
39 rc_check
40 ((++n))
41 done
42 fi
43 if test -n "${losd}" ; then
44 for s in ${losd#=${prefix}} ; do
45 systemctl "${action}" ceph-osd@${s#$prefix}.service
46 rc_check
47 ((++n))
48 done
49 fi
50 if test $n -gt 0 ; then
51 rc_status
52 else
53 rc_status -u
54 fi
55 systemctl "${action}" ceph.target
56 rc_check
57 ;;
58 *)
59 echo "Invalid parameter : $action"
60 echo "Valid parameters : start | stop | status | enable | disable | mask | unmask | restart | is-active | is-failed | show | kill | reset-failed"
61 ;;
62 esac
63
64 rc_exit
65