]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
initscript: incorporate Josef's fedora fixes
authorSage Weil <sage@newdream.net>
Thu, 27 May 2010 21:58:56 +0000 (14:58 -0700)
committerSage Weil <sage@newdream.net>
Thu, 27 May 2010 21:58:56 +0000 (14:58 -0700)
Add 'status' command.
Add chkconfig line.
Do lockfile stuff only if /var/run/subsys exists.

Still specifying the runlevels, though.  The init script bails out (with
success code) if the ceph.conf is missing.

ceph-init-fix.patch [deleted file]
ceph.spec.in
src/init-ceph.in

diff --git a/ceph-init-fix.patch b/ceph-init-fix.patch
deleted file mode 100644 (file)
index 2f88591..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-diff -up ceph-0.19.1/src/init-ceph.in.orig ceph-0.19.1/src/init-ceph.in
---- ceph-0.19.1/src/init-ceph.in.orig  2010-02-28 23:46:29.000000000 -0500
-+++ ceph-0.19.1/src/init-ceph.in       2010-04-20 10:25:37.793135436 -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"
-@@ -240,6 +243,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
-           fi
-           ;;
-       
-@@ -249,19 +253,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)
index 42ab00e7bc2ca2643a3a93c1f74bf1c3cd6c3a1e..0a1d5051983da65402e2a9c7850e44990d4a37f1 100644 (file)
@@ -7,7 +7,6 @@ Group:         System Environment/Base
 URL:           http://ceph.newdream.net/
 
 Source:        http://ceph.newdream.net/download/%{name}-%{version}.tar.gz
-Patch0:        ceph-init-fix.patch
 BuildRequires: fuse-devel, libtool, libtool-ltdl-devel, boost-devel, 
 BuildRequires: libedit-devel, fuse-devel, git, perl, gdbm,
 BuildRequires: openssl-devel, libatomic_ops-devel
@@ -38,8 +37,6 @@ This package contains the headers needed to develop programs that use Ceph.
 
 %prep
 %setup -q
-%patch0 -p1
-chmod 0644 src/common/Mutex.h
 
 %build
 ./autogen.sh
index 49c5535fcd81d363c276ecce823eef95f8dfcb7c..9fbaf932948eb78ec28a96c7ba92ecc2873190a2 100644 (file)
@@ -1,5 +1,6 @@
 #!/bin/sh
 # Start/stop ceph daemons
+# chkconfig: 2345 60 80
 
 ### BEGIN INIT INFO
 # Provides:          ceph
@@ -28,6 +29,13 @@ else
     fi
 fi
 
+# do lockfile, if RH
+if [ -d /var/lock/subsys ]; then
+    lockfile=/var/lock/subsys/ceph
+else
+    lockfile=
+fi
+
 usage_exit() {
     echo "usage: $0 [options] {start|stop|restart} [mon|osd|mds]..."
     printf "\t-c ceph.conf\n"
@@ -244,6 +252,7 @@ for name in $what; do
            [ -n "$pre_start" ] && do_cmd "$pre_start"
            do_cmd "$cmd" $runarg
            [ -n "$post_start" ] && do_cmd "$post_start"
+           [ -n "$lockfile"] && [ "$?" = 0 ] && touch $lockfile
            ;;
        
        stop)
@@ -252,19 +261,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"
+           [ -n "$lockfile"] && [ "$?" = 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"
+           [ -n "$lockfile"] && [ "$?" = 0 ] && rm -f $lockfile
            ;;
            
        killall)
            echo "killall c$type on $host"
            do_cmd "pkill ^c$type || true"
+           [ -n "$lockfile"] && [ "$?" = 0 ] && rm -f $lockfile
            ;;
        
        force-reload | reload)