tstellar / rpms / ceph

Forked from rpms/ceph 2 years ago
Clone
Blob Blame History Raw
diff -up ceph-0.20/src/init-ceph.in.init ceph-0.20/src/init-ceph.in
--- ceph-0.20/src/init-ceph.in.init	2010-04-22 16:11:34.000000000 -0400
+++ ceph-0.20/src/init-ceph.in	2010-05-05 15:37:11.185677759 -0400
@@ -1,10 +1,11 @@
 #!/bin/sh
 # Start/stop ceph daemons
+# chkconfig: - 60 80
 
 ### BEGIN INIT INFO
 # Provides:          ceph
-# Default-Start:     2 3 4 5
-# Default-Stop:      0 1 6
+# Default-Start:
+# Default-Stop:
 # Required-Start:    $remote_fs $named $network $time
 # Required-Stop:     $remote_fs $named $network $time
 # Short-Description: Start Ceph distributed file system daemons at boot time
@@ -28,6 +29,8 @@ else
     fi
 fi
 
+lockfile=/var/lock/subsys/ceph
+
 usage_exit() {
     echo "usage: $0 [options] {start|stop|restart} [mon|osd|mds]..."
     printf "\t-c ceph.conf\n"
@@ -244,6 +247,7 @@ for name in $what; do
 	    [ -n "$pre_start" ] && do_cmd "$pre_start"
 	    do_cmd "$cmd" $runarg
 	    [ -n "$post_start" ] && do_cmd "$post_start"
+	    [ "$?" = 0 ] && touch $lockfile
 	    ;;
 	
 	stop)
@@ -252,19 +256,27 @@ for name in $what; do
 	    [ -n "$pre_stop" ] && do_cmd "$pre_stop"
 	    stop_daemon $name c$type $pid_file
 	    [ -n "$post_stop" ] && do_cmd "$post_stop"
+	    [ "$?" = 0 ] && rm -f $lockfile
 	    ;;
 
+	status)
+	    pid=`cat $pid_file`
+	    ps $pid &> /dev/null
+	    exit $?
+	    ;;
 	forcestop)
 	    get_conf pre_forcestop "" "pre forcestop command"
 	    get_conf post_forcestop "" "post forcestop command"
 	    [ -n "$pre_forcestop" ] && do_cmd "$pre_forcestop"
 	    stop_daemon $name c$type $pid_file -9
 	    [ -n "$post_forcestop" ] && do_cmd "$post_forcestop"
+	    [ "$?" = 0 ] && rm -f $lockfile
 	    ;;
 	    
 	killall)
 	    echo "killall c$type on $host"
 	    do_cmd "pkill ^c$type || true"
+	    [ "$?" = 0 ] && rm -f $lockfile
 	    ;;
 	
 	force-reload | reload)