From c6f2fd36e0a8188e1f6b2a15b292e3d0a5610ac4 Mon Sep 17 00:00:00 2001 From: Albert Cervin Date: Sun, 19 Mar 2023 17:18:01 +0100 Subject: =?UTF-8?q?=F0=9F=8E=89=20Initial=20commit=20of=20infra?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/jexec.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 library/jexec.sh (limited to 'library/jexec.sh') diff --git a/library/jexec.sh b/library/jexec.sh new file mode 100755 index 0000000..2c4e19d --- /dev/null +++ b/library/jexec.sh @@ -0,0 +1,17 @@ +#! /usr/bin/env sh +set -e +jsonargs='<>' + +jailname=$(echo "$jsonargs" | jq -r '.jail' -) +cmd=$(echo "$jsonargs" | jq -r '.cmd' -) + +jexec -l -u root "$jailname" /bin/sh -c "$cmd" + +rc=$? +if [ $rc != 0 ]; then + failed="false" +else + failed="true" +fi + +echo '{ "msg": "'"$jailname"'", "rc": '"$rc"', "failed": false }' -- cgit v1.2.3