Permalink
Browse files

Merge pull request #4056 from dmitryya/issue_11140

rgw: init script in stop action waits until the radosgw stops

Reviewed-by: Loic Dachary <ldachary@redhat.com>
  • Loading branch information...
2 parents 0bee274 + 1cca0c1 commit 059674a686b4c6e5d19d5204dc41ab13d2954d0a @ldachary ldachary committed Mar 23, 2015
Showing with 20 additions and 1 deletion.
  1. +9 −1 src/init-radosgw
  2. +11 −0 src/init-radosgw.sysv
View
@@ -87,7 +87,15 @@ case "$1" in
$0 start
;;
stop)
- start-stop-daemon --stop -x $RADOSGW --oknodo
+ timeout=0
+ for name in `ceph-conf --list-sections $PREFIX`;
+ do
+ t=`$RADOSGW -n $name --show-config-value rgw_exit_timeout_secs`
+ if [ $t -gt $timeout ]; then timeout=$t; fi
+ done
+
+ if [ $timeout -gt 0 ]; then TIMEOUT="-R $timeout"; fi
+ start-stop-daemon --stop -x $RADOSGW --oknodo $TIMEOUT
;;
status)
daemon_is_running $RADOSGW
View
@@ -101,8 +101,19 @@ case "$1" in
;;
stop)
#start-stop-daemon --stop -x $RADOSGW --oknodo
+ timeout=0
+ for name in `ceph-conf --list-sections $PREFIX`;
+ do
+ t=`$RADOSGW -n $name --show-config-value rgw_exit_timeout_secs`
+ if [ $t -gt $timeout ]; then timeout=$t; fi
+ done
+
killproc $RADOSGW
echo "Stopping radosgw instance(s)..."
+ while pidof $RADOSGW >/dev/null && [ $timeout -gt 0 ] ; do
+ sleep 1
+ timeout=$(($timeout - 1))
+ done
;;
status)
daemon_is_running $RADOSGW

0 comments on commit 059674a

Please sign in to comment.