19 lines
707 B
Bash
19 lines
707 B
Bash
#!/usr/bin/env bash
|
|
# Optional cgroup development launcher, independent of any init system.
|
|
set -euo pipefail
|
|
if (( $# == 0 )); then
|
|
echo 'Usage: bash tests/run-delegated-reader.sh /absolute/path/to/cthulhu [reader options]' >&2
|
|
exit 2
|
|
fi
|
|
if [[ $1 != /* || ! -x $1 ]]; then
|
|
echo 'The reader executable must be an absolute executable path.' >&2
|
|
exit 2
|
|
fi
|
|
parent=${CTHULHU_TENTACLE_CGROUP_PARENT:-}
|
|
if [[ $parent != /* || ! -d $parent || ! -w $parent ]]; then
|
|
echo 'Set CTHULHU_TENTACLE_CGROUP_PARENT to an already delegated, writable cgroup v2 parent.' >&2
|
|
echo 'Ordinary Tentacle use needs no launcher or cgroup setup.' >&2
|
|
exit 2
|
|
fi
|
|
exec "$@" --tentacle-cgroup-parent "$parent"
|