]> git.pld-linux.org Git - projects/rc-scripts.git/commitdiff
as we are redirecting to systemd, detect when systemd redirects back due /sbinservice...
authorElan Ruusamäe <glen@pld-linux.org>
Sat, 17 Mar 2012 09:32:55 +0000 (09:32 +0000)
committerElan Ruusamäe <glen@pld-linux.org>
Sat, 17 Mar 2012 09:32:55 +0000 (09:32 +0000)
svn-id: @12496

service

diff --git a/service b/service
index 470e72eb9a91c75f30ff24ae2e53a905bee6c4df..2060323a79000a683c67d0af4645c5690a856b2e 100755 (executable)
--- a/service
+++ b/service
@@ -23,6 +23,14 @@ is_systemd_service() {
 
        [ "$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 | \
This page took 0.035957 seconds and 4 git commands to generate.