diff --git a/scripts/systemctl-wrapper.sh b/scripts/systemctl-wrapper.sh new file mode 100644 index 00000000..1a570f8b --- /dev/null +++ b/scripts/systemctl-wrapper.sh @@ -0,0 +1,16 @@ +#!/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 "$@"