jw-pkg/scripts/systemctl-wrapper.sh

16 lines
363 B
Bash
Raw Normal View History

#!/bin/bash
reason=""
systemctl="/usr/bin/systemctl"
[ "$(ps -p 1 -o comm=)" = "systemd" ] || reason="Trying to run $exe in an environment not controlled by Systemd"
[ -x $systemctl ] || reason="Can't run $exe."
if [ "$reason" ]; then
title="$reason. Ignoring."
echo ",-- $title -- >"
echo "| $0 $@"
echo "\`-- $title -- <"
exit 0
fi
exec $systemctl "$@"