Command works in HA terminal, doesn’t as command line sensor

Found a solution. I had to figure out first why the command didn’t work. Someone posted a helpful tip here, The suggestion was to append 2> /config/command.log to the end of the ssh command in order to write the output from the command to a file. Which got me this error:

Permission denied, please try again.
[email protected]: Permission denied (publickey,password).

Some error with ssh keys for sure.
And then I stumbled upon this post from user @CentralCommand:

Finally understood why my code wasn’t working.
This is the solution:

ssh -o UserKnownHostsFile=/config/.ssh/known_hosts [email protected] -i /config/.ssh/id_rsa 'iocage exec wgvpn ping -c 1 google.com &> /dev/null && echo "Online" || echo "Offline"'
2 Likes