#! /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 }'