aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>2010-08-20 17:14:25 -0400
committerBill Nottingham <notting@redhat.com>2010-08-20 17:14:25 -0400
commit64343a8c1191cfb4bcb209aef001942ffc7d60d9 (patch)
tree44bb5fc3360a261558e1ea96e1e5f193e3b426aa
parent6b548207e870f4e0d51937b0ae6e82f0e3d92dc5 (diff)
downloadinitscripts-64343a8c1191cfb4bcb209aef001942ffc7d60d9.tar
initscripts-64343a8c1191cfb4bcb209aef001942ffc7d60d9.tar.gz
initscripts-64343a8c1191cfb4bcb209aef001942ffc7d60d9.tar.bz2
initscripts-64343a8c1191cfb4bcb209aef001942ffc7d60d9.tar.xz
initscripts-64343a8c1191cfb4bcb209aef001942ffc7d60d9.zip
If a systemd service exists, use systemctl to frob it.
-rwxr-xr-xservice3
1 files changed, 3 insertions, 0 deletions
diff --git a/service b/service
index 7d7dea8e..0fe03fda 100755
--- a/service
+++ b/service
@@ -7,6 +7,7 @@ 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
@@ -60,6 +61,8 @@ done
if [ -f "${SERVICEDIR}/${SERVICE}" ]; then
env -i PATH="$PATH" TERM="$TERM" "${SERVICEDIR}/${SERVICE}" ${OPTIONS}
+elif [ -f "${SYSTEMDSERVICEDIR}/${SERVICE}.service" ]; then
+ exec /bin/systemctl ${OPTIONS} ${SERVICE}.service
else
echo $"${SERVICE}: unrecognized service" >&2
exit 1