From e1afcc44754dab8adc7dd1099fbea61b941e52d9 Mon Sep 17 00:00:00 2001 From: Michal Schmidt Date: Sat, 24 Sep 2011 13:04:09 +0200 Subject: do not check for the existence of a systemd unit before redirecting It is wrong to look only in /lib/systemd/system. systemd can handle units in several other directories as well. The check is needless. Simply redirect everything that's not a SysV service and let systemctl report an error if it's invalid. --- service | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'service') diff --git a/service b/service index 1a426356..6f179347 100755 --- a/service +++ b/service @@ -7,7 +7,6 @@ USAGE="Usage: $(basename $0) < option > | --status-all | \ [ service_name [ command | --full-restart ] ]" SERVICE= SERVICEDIR="/etc/init.d" -SYSTEMDSERVICEDIR="/lib/systemd/system" OPTIONS= if [ $# -eq 0 ]; then @@ -69,10 +68,7 @@ done if [ -f "${SERVICEDIR}/${SERVICE}" ]; then env -i PATH="$PATH" TERM="$TERM" SYSTEMCTL_IGNORE_DEPENDENCIES=${SYSTEMCTL_IGNORE_DEPENDENCIES} SYSTEMCTL_SKIP_REDIRECT=${SYSTEMCTL_SKIP_REDIRECT} "${SERVICEDIR}/${SERVICE}" ${OPTIONS} -elif [ -f "${SYSTEMDSERVICEDIR}/${SERVICE}.service" ]; then +else echo $"Redirecting to /bin/systemctl ${OPTIONS} ${SERVICE}.service" >/dev/stderr exec /bin/systemctl ${OPTIONS} ${SERVICE}.service -else - echo $"${SERVICE}: unrecognized service" >&2 - exit 1 fi -- cgit v1.2.1