trigger ssh command on raspberry pi
-
I am trying to execute a ssh command and it doesnt seem to be running using the below.
{"trigger":"Plex Movie Update","command":"ssh -p 5001 user@10.0.0.90 /movies3.sh","ground":"background","voice":"Plex Movie Update","allowParams": "false"},
if i just run
"ssh -p 5001 user@10.0.0.90 /movies3.sh " on my raspberry pi , it will run. I have enabled passwordless sshhow do it see if the command is running on my voice trigger and what the error is stopping it from running?
-
@thibou-justin, I wonder if you're testing the command while logged in as the pi user, but when the command runs it's running as root. If it runs as root, ssh will look for the private key in /root/.ssh/id_rsa. When you run the ssh command as pi, it looks for the private key in /home/pi/.ssh/id_rsa.
If that's the problem, you could solve it by copying /home/pi/.ssh/id_rsa to /root/.ssh/id_rsa.
It's standard to run the triggercmdagent in background mode on a Raspberry Pi. That's how it runs when you install the background service.
Another suggestion: Create a script, and put the ssh command in it but with >> /tmp/sshlog.txt at the end of the command line, then have the TRIGGERcmd agent run the script. That way you'll get a log of what the error was.
-
@Russ Awesome... that fixed it! Of note i did have to do it this way
sudo cp /home/pi/.ssh/id_rsa /root/.ssh/id_rsa -f since i was getting errors , but once i did that i ran a sudo more /root/.ssh/id_rsa and compared to the pi id_rssa , and saw they were identical now , then ran triggercommand from voice and it all worked. I did even add it to google home as a routine so i can just say "ok google update my movies" and it all works!!! much much appreciated. Thank you! do you have a donations page? i just see the subscription, and would like to show my appreciation -Justin -
@thibou-justin,
I'm glad that worked.
No, I don't have a donations page - just the annual subscription.