Hello, welcome to the forums!A simplified code that satisfies both conditions isThe second condition cannot raise an error because shutdown_timer is initialized as an integer before in the code. Therefore, the reason comes from something in the first condition that may prevent this expression from generating an integer.
You can simulate a similar error like this:So you have to find what can trigger this error in this expression:The script you are using was not designed to account for possible errors.
line 76 isCode:
Apr 01 19:40:51 debian wake.sh[443]: /usr/local/bin/wake.sh: line 76: [: too many arguments
Code:
if [ $(curl -s --user $tvh_login:$tvh_password http://127.0.0.1:9981/status.xml | grep "subscriptions" | awk -F '>' '{print $2}' | awk -F '<' '{print $1}') -ne 0 -a $shutdown_timer -eq 0 ]; then
Code:
if [ 1 -ne 0 -a 0 -eq 0 ]; then echo "shutdown_timer set to 1"; fi
You can simulate a similar error like this:
Code:
$> shutdown_timer="0"$> unset testvar$> [ $testvar -ne 0 -a $shutdown_timer -eq 0 ]bash: [: too many arguments
Code:
curl -s --user $tvh_login:$tvh_password http://127.0.0.1:9981/status.xml | grep "subscriptions" | awk -F '>' '{print $2}' | awk -F '<' '{print $1}'
- Is curl installed?
- Are tvh_login and tvh_password set correctly in the script?
- Is your local server working properly? You can test if it works:
Code:
$> curl -s --user YOURtvh_login:YOURtvh_password http://127.0.0.1:9981/status.xml
- If it works, does this output a single line:
Code:
$> curl -s --user YOURtvh_login:YOURtvh_password http://127.0.0.1:9981/status.xml | grep "subscriptions"
- And finally, does this output a single number:
Code:
curl -s --user YOURtvh_login:YOURtvh_password http://127.0.0.1:9981/status.xml | grep "subscriptions" | awk -F '>' '{print $2}' | awk -F '<' '{print $1}'
Statistics: Posted by fabien — 2024-04-01 22:52 — Replies 1 — Views 34