Hi Michael, Quoting Michael Biebl (2012-08-24 16:03:07) > I've been looking at the jessie-pending branch, and I was wondering why > you translate force-reload unconditionally to systemctl restart. > This should only be the case, if the systemd service does not support > reload, i.e. force-reloads should translate to: > > service supports reload → reload > service does not support reload → restart > > That's at least how sysvinit handles it afaics. I’ve attached a patch to this message which does what we discussed on IRC: It will try to reload when the service has CanReload=yes and will fall-back to restart if that doesn’t work.
Also note that I changed the reload) code branch because: 1) It didn’t work since $service was empty. 2) Even if it worked, it would never trigger for sysv-compat-layer scripts since CanReload is always yes for them. Best regards, Michael
--- /usr/sbin/invoke-rc.d.O 2012-08-27 23:50:29.391881227 +0200 +++ /usr/sbin/invoke-rc.d 2012-08-27 23:52:57.712504675 +0200 @@ -512,21 +512,22 @@ esac elif [ -n "$is_systemd" ]; then case $saction in - start|stop|restart|status) + start|stop|restart|status|reload) systemctl "${saction}" "${INITSCRIPTID}.service" && exit 0 ;; - reload) - _canreload="$(systemctl -p CanReload show $service 2>/dev/null)" - if [ "$_canreload" = "CanReload=no" ]; then - "${INITDPREFIX}${INITSCRIPTID}" "${saction}" "$@" && exit 0 - else - systemctl reload "${INITSCRIPTID}.service" && exit 0 - fi - ;; force-stop) systemctl --signal=KILL kill "${INITSCRIPTID}.service" && exit 0 ;; force-reload) + _canreload="$(systemctl -p CanReload show ${INITSCRIPTID}.service 2>/dev/null)" + if [ "$_canreload" = "CanReload=yes" ]; then + # Try to reload if the service file supports Reload. + # NB: All sysv-compat-layer service files have + # CanReload=yes, no matter whether they support + # reloads or not. We just try to reload, if it + # doesn't work, we will fall back to restart. + systemctl reload "${INITSCRIPTID}.service" && exit 0 + fi systemctl restart "${INITSCRIPTID}.service" && exit 0 ;; *)