Skip to content

Commit

Permalink
init-radosgw: do not use systemd-run in sysvinit
Browse files Browse the repository at this point in the history
`systemd-run` logic in initscripts was introduced because of ticket
http://tracker.ceph.com/issues/7627.

If we have systemd-based operating system, we should use systemd unit files
from systemd directory to start/stop ceph daemons.
Otherwise, `daemon()` from `/etc/init.d/functions` on systemd distro starts service
in `system.slice` and everything works well.

`systemd-run` can not be run on non-systemd distros, so it's not needed
on SysV systems.

also, ceph-disk is now able to run the "systemctl"
to enable and start the ceph-osd, and ceph-deploy is also now
playing well with systemd when it comes to ceph-mon and ceph-mds

Fixes: http://tracker.ceph.com/issues/16440

Signed-off-by: Vladislav Odintsov <odivlad@gmail.com>
(cherry picked from commit 1fd4f92)
  • Loading branch information
odivlad committed Jul 14, 2016
1 parent 387d5c1 commit b82c204
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/init-radosgw
Expand Up @@ -17,10 +17,6 @@ if [ -x /sbin/start-stop-daemon ]; then
else
. /etc/rc.d/init.d/functions
DEBIAN=0

# detect systemd, also check whether the systemd-run binary exists
SYSTEMD_RUN=$(which systemd-run 2>/dev/null)
grep -qs systemd /proc/1/comm || SYSTEMD_RUN=""
fi

daemon_is_running() {
Expand Down Expand Up @@ -99,10 +95,8 @@ case "$1" in
fi

echo "Starting $name..."
if [ $DEBIAN -eq 1 ]; then
start-stop-daemon --start -u $user -x $RADOSGW -p /var/run/ceph/client-$name.pid -- -n $name
elif [ -n "$SYSTEMD_RUN" ]; then
$SYSTEMD_RUN -r su "$user" -c "ulimit -n 32768; $RADOSGW -n $name"
if [ $DEBIAN -eq 1 ]; then
start-stop-daemon --start -u $user -x $RADOSGW -p /var/run/ceph/client-$name.pid -- -n $name
else
ulimit -n 32768
daemon --user="$user" "$RADOSGW -n $name"
Expand Down

0 comments on commit b82c204

Please sign in to comment.