From d7ebcc28d70ba1b5bb63073e5ae9a31b031ccfb9 Mon Sep 17 00:00:00 2001 From: Alexey Shabalin Date: Fri, 28 Jan 2011 20:01:48 +0300 Subject: [PATCH] add systemd support --- service/service | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-) diff --git a/service/service b/service/service index 2e5b421..d6f31dc 100644 --- a/service/service +++ b/service/service @@ -9,6 +9,8 @@ export PATH VERSION="service version 0.91-alt" SERVICEDIR="/etc/init.d" +SYSTEMCTL="/bin/systemctl" +SYSTEMDSERVICEDIR="/lib/systemd/system" SERVICE= OPTIONS= @@ -35,7 +37,7 @@ check_service() [ -n "${SERVICE##*/*}" ] || fatal "$SERVICE: Invalid service name" - [ -x "$SERVICEDIR/$SERVICE" ] || + [ -x "$SERVICEDIR/$SERVICE" ] || [ -x "$SYSTEMCTL" -a -f "$SYSTEMDSERVICEDIR/${SERVICE}.service" ] || fatal "$SERVICE: Unrecognized service" } @@ -69,7 +71,12 @@ case "$1" in shift check_service cd / || exit - "$SERVICEDIR/$SERVICE" "$@" + if [ -x "$SERVICEDIR/$SERVICE" ]; then + "$SERVICEDIR/$SERVICE" "$@" + elif [ -x "$SYSTEMCTL" -a -f "$SYSTEMDSERVICEDIR/${SERVICE}.service" ]; then + echo "Redirecting to /bin/systemctl $OPTIONS $SERVICE.service" >/dev/stderr + exec $SYSTEMCTL "$@" ${SERVICE}.service + fi exit $? ;; esac -- 1.7.3.5