tstellar / rpms / ceph

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