]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
init-radosgw.sysv: Support systemd for starting the gateway 2486/head
authorJuanJose 'JJ' Galvez <jgalvez@redhat.com>
Mon, 15 Sep 2014 03:38:20 +0000 (20:38 -0700)
committerJuanJose 'JJ' Galvez <jgalvez@redhat.com>
Mon, 15 Sep 2014 03:38:20 +0000 (20:38 -0700)
When using RHEL7 the radosgw daemon needs to start under systemd.

Check for systemd running on PID 1. If it is then start
the daemon using: systemd-run -r <cmd>. pidof returns null
as it is executed too quickly, adding one second of sleep and
script reports startup correctly.

Signed-off-by: JuanJose 'JJ' Galvez <jgalvez@redhat.com>
src/init-radosgw.sysv

index ab6b2507380287e96d485a062d96471f1907b62b..dd3dbb08ada81219ba5aabe81b649fbdd5de3bd9 100644 (file)
@@ -15,6 +15,7 @@ PATH=/sbin:/bin:/usr/bin
 
 daemon_is_running() {
     daemon=$1
+    sleep 1
     if pidof $daemon >/dev/null; then
         echo "$daemon is running."
         exit 0
@@ -44,6 +45,10 @@ if [ ! -x "$RADOSGW" ]; then
     exit 1
 fi
 
+# detect systemd
+SYSTEMD=0
+grep -qs systemd /proc/1/comm && SYSTEMD=1
+
 case "$1" in
     start)
         echo "Starting radosgw instance(s)..."
@@ -79,8 +84,12 @@ case "$1" in
                 chown $user $log_file
             fi
 
-            #start-stop-daemon --start -u $user -x $RADOSGW -- -n $name
-            daemon --user="$user" "ulimit -n 32768; $RADOSGW -n $name"
+            if [ $SYSTEMD -eq 1 ]; then
+                systemd-run -r bash -c "ulimit -n 32768; $RADOSGW -n $name"
+            else
+                #start-stop-daemon --start -u $user -x $RADOSGW -- -n $name
+                daemon --user="$user" "ulimit -n 32768; $RADOSGW -n $name"
+            fi
             echo "Starting $name..."
         done
         daemon_is_running $RADOSGW