service: use systemd if running, fallback to sysv5 if not

This commit is contained in:
Silvan Calarco 2013-03-26 20:28:36 +01:00
parent 6bd9de13f4
commit 41b99cdb29

View File

@ -35,7 +35,9 @@ while [ $# -gt 0 ]; do
esac
done
if [ -x "${INITDDIR}/${SERVICE}" ]; then
if [ -d /run/systemd ]; then
systemctl ${OPTIONS} ${SERVICE}.service
elif [ -x "${INITDDIR}/${SERVICE}" ]; then
env -i PATH="$PATH" TERM="$TERM" "${INITDDIR}/${SERVICE}" ${OPTIONS}
else
echo "${SERVICE}: "$"unrecognized service" >&2