Hi,
Version: 3.0.4.1033
Package Version: 3.0.4.1033-ls14 by linuxserver.io
Mono Version: 5.20.1.34
Debug logs: no valuable information about my script in it but found this in the events Invalid request Validation failed: -- : Script exited with code: 1
Description of issue:
I’m trying to run a BASH script to push notifications to RocketChat. It works from the Docker container but not from Sonarr, I don’t understand why.
I use 2 scripts, one to pass whatever to RC and another one making it easier to pass some arguments.
1st script, called by the 2nd one: rocketchatsendmsg.sh
#!/bin/bash
function usage {
programName=$0
echo "description: use this program to post messages to Rocket.chat channel"
echo "usage: $programName [-b \"message body\"] [-u \"rocket.chat url\"]"
echo " -b The message body"
echo " -u The rocket.chat hook url to post to"
exit 1
}
while getopts ":b:u:h" opt; do
case ${opt} in
u) rocketUrl="$OPTARG"
;;
b) msgBody="$OPTARG"
;;
h) usage
;;
\?) echo "Invalid option -$OPTARG" >&2
;;
esac
done
if [[ ! "${rocketUrl}" || ! "${msgBody}" ]]; then
echo "all arguments are required"
usage
fi
read -d '' payLoad << EOF
{"text": "${msgBody}"}
EOF
echo $payLoad
statusCode=$(curl \
--write-out %{http_code} \
--silent \
--output /dev/null \
-X POST \
-H 'Content-type: application/json' \
--data "${payLoad}" ${rocketUrl})
echo ${statusCode}
2nd script should be called from Sonarr: sonarrrc.sh
#!/bin/bash
WEEBHOOK=https://chat.xxx.org/hooks/xxx
/downloads/sonarrrc/rocketchatsendmsg.sh -b "$1" -u "$WEEBHOOK"
BTW it works with curl:
curl -X POST -H 'Content-Type: application/json' --data '{"emoji":":sonarr:","text":"$1"}' https://chat.upandclear.org/hooks/xxx
Any king help would be appreciated.
A.