We want to make sure the daemon runs in its own systemd environment. Check
for systemd as pid 1 and, when present, use systemd-run -r <cmd> to do
this.
Probably fixes #7627
Signed-off-by: Sage Weil <sage@redhat.com>
Reviewed-by: Dan Mick <dan.mick@inktank.com>
Tested-by: Dan Mick <dan.mick@inktank.com>
EXIT_STATUS=0
+# detect systemd
+SYSTEMD=0
+grep -qs systemd /proc/1/comm && SYSTEMD=1
+
signal_daemon() {
name=$1
daemon=$2
[ -n "$wrap" ] && runmode="-f &" && runarg="-f"
[ -n "$max_open_files" ] && files="ulimit -n $max_open_files;"
- cmd="$files $wrap $cmd --cluster $cluster $runmode"
+ if [ $SYSTEMD -eq 1 ]; then
+ cmd="systemd-run -r bash -c '$files $cmd --cluster $cluster -f'"
+ else
+ cmd="$files $wrap $cmd --cluster $cluster $runmode"
+ fi
if [ $dofsmount -eq 1 ] && [ -n "$fs_devs" ]; then
get_conf pre_mount "true" "pre mount command"