X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Fceph%2Fsystemd%2Fceph;fp=src%2Fceph%2Fsystemd%2Fceph;h=6a69271688732653d25b957c948f42b519d8641f;hb=812ff6ca9fcd3e629e49d4328905f33eee8ca3f5;hp=0000000000000000000000000000000000000000;hpb=15280273faafb77777eab341909a3f495cf248d9;p=stor4nfv.git diff --git a/src/ceph/systemd/ceph b/src/ceph/systemd/ceph new file mode 100644 index 0000000..6a69271 --- /dev/null +++ b/src/ceph/systemd/ceph @@ -0,0 +1,65 @@ +#! /bin/bash + +### BEGIN INIT INFO +# Provides: ceph ceph-mon ceph-osd +# Required-Start: $network $remote_fs +# Required-Stop: $network $remote_fs +# Should-Start: network-remotefs +# Should-Stop: network-remotefs +# Default-Start: 3 5 +# Default-Stop: 0 1 2 6 +# Short-Description: Ceph is a distributed object, and block, storage platform +# Description: Ceph is a distributed object, block, and file storage platform +### END INIT INFO + +SYSTEMD_NO_WRAP=1 . /etc/rc.status +rc_reset + +action=$1 ; shift + +# default cluster name to "ceph" +cluster="ceph" + +# Shared variables by many actions +dir_mon="/var/lib/ceph/mon/" +dir_osd="/var/lib/ceph/osd/" +if test -d ${dir_mon} ; then + lmon=`ls ${dir_mon} | grep ${cluster}` +fi +if test -d ${dir_osd} ; then + losd=`ls ${dir_osd} | grep ${cluster}` +fi +prefix="${cluster}-" + +case $action in start | stop | status | enable | disable | mask | unmask | restart | is-active | is-failed | show | kill | reset-failed ) + n=0 + if test -n "${lmon}" ; then + for s in ${lmon#=${prefix}} ; do + systemctl "${action}" ceph-mon@${s#$prefix}.service + rc_check + ((++n)) + done + fi + if test -n "${losd}" ; then + for s in ${losd#=${prefix}} ; do + systemctl "${action}" ceph-osd@${s#$prefix}.service + rc_check + ((++n)) + done + fi + if test $n -gt 0 ; then + rc_status + else + rc_status -u + fi + systemctl "${action}" ceph.target + rc_check +;; +*) + echo "Invalid parameter : $action" + echo "Valid parameters : start | stop | status | enable | disable | mask | unmask | restart | is-active | is-failed | show | kill | reset-failed" +;; +esac + +rc_exit +