[packages/ceph] 'cephtctl' scrip ported to PLD

jajcus jajcus at pld-linux.org
Tue May 12 15:21:41 CEST 2015


commit 8b205fd7c0030b04a0194d0fc1dbb2ed437461f8
Author: Jacek Konieczny <j.konieczny at eggsoft.pl>
Date:   Tue May 5 10:51:13 2015 +0200

    'cephtctl' scrip ported to PLD

 cephctl | 35 ++++++++++-------------------------
 1 file changed, 10 insertions(+), 25 deletions(-)
---
diff --git a/cephctl b/cephctl
index e60dec6..9bd4d90 100644
--- a/cephctl
+++ b/cephctl
@@ -1,22 +1,11 @@
 #! /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
+# It seems this was designed as /etc/init.d/ceph script for controlling the systemd
+# units on SuSE, made into 'cephctl' for PLD
 
 action=$1 ; shift
-cluster="ceph"
+[ -f /etc/sysconfig/ceph ] && . /etc/sysconfig/ceph
+cluster=${CLUSTER:-ceph}
 config=$1 ; shift
 
 # Shared variables by many actions
@@ -30,8 +19,10 @@ losd=`ls ${dir_osd} | grep ${cluster}`
 fi
 prefix="${cluster}-"
 
+RC=0
+
 if test -n "$config" ; then
-	systemctl "${action}" "ceph-mon@${config}.service"
+	systemctl "${action}" "ceph-mon@${config}.service" || RC=1
 else
 	case $action in
     start | stop | status | enable | disable | restart | is-active | is-failed | show | kill | reset-failed  )
@@ -39,22 +30,17 @@ else
         if test -n ${lmon} ; then
             for s in ${lmon#=${prefix}} ; do
                 systemctl "${action}" ceph-mon@${s#$prefix}.service
-                rc_check
+		[ $? -eq 0 ] || RC=1
                 ((++n))
             done
         fi
         if test -n ${lmon} ; then
             for s in ${losd#=${prefix}} ; do
                 systemctl "${action}" ceph-osd@${s#$prefix}.service
-                rc_check
+		[ $? -eq 0 ] || RC=1
                 ((++n))
             done
         fi
-        if test $n -gt 0 ; then
-			rc_status
-		else
-			rc_status -u
-		fi
     ;;
 	*)
 		echo "Invalid paramter : $action"
@@ -62,5 +48,4 @@ else
 	;;
 	esac
 fi
-rc_exit
-
+exit $RC
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/ceph.git/commitdiff/bef2a0adcd4524aa642815f98eacbec842270e2a



More information about the pld-cvs-commit mailing list