[ "$USE_SYSTEMD" = "no" ] && return 1
+ # if we are called from systemd itself, because some .service specified
+ # invocation via /sbin/service. this avoids loops
+ # detect this via CMDLINE var, which has leaked from geninitrd
+ if [ -n "$CMDLINE" ]; then
+ echo >&2 "Warning: CMDLINE env set, likely you are defining .service to use /sbin/service, please use /etc/rc.d/init.d/<SERVICE> instead"
+ return 1
+ fi
+
case "$ACTION" in
# list obtained as: man systemctl | grep N.*A.*M.*E
start | \
done
if is_systemd_service "${SERVICE}" "${ACTION}"; then
- echo >&2 "Redirecting to /bin/systemctl ${ACTION} ${SERVICE}.service ${OPTIONS}"
- exec /bin/systemctl ${ACTION} ${SERVICE}.service ${OPTIONS}
+ echo >&2 "Redirecting to /bin/systemctl --output=cat ${ACTION} ${SERVICE}.service ${OPTIONS}"
+ exec /bin/systemctl --output=cat ${ACTION} ${SERVICE}.service ${OPTIONS}
elif [ -x "${SERVICEDIR}/${SERVICE}" ]; then
exec env -i USE_UPSTART=$USE_UPSTART LANG=$LANG PATH=$PATH TERM=$TERM "${SERVICEDIR}/${SERVICE}" ${ACTION} ${OPTIONS}
else