• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
TRIGGERcmd
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login

trigger ssh command on raspberry pi

Raspberry Pi
2
4
599
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T
    thibou.justin
    last edited by Oct 23, 2021, 4:25 AM

    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 ssh

    how do it see if the command is running on my voice trigger and what the error is stopping it from running?

    R 1 Reply Last reply Oct 23, 2021, 7:26 PM Reply Quote 0
    • R
      Russ @thibou.justin
      last edited by Oct 23, 2021, 7:26 PM

      @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.

      Russell VanderMey

      1 Reply Last reply Reply Quote 0
      • T
        thibou.justin
        last edited by Oct 24, 2021, 12:17 AM

        @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

        R 1 Reply Last reply Oct 24, 2021, 1:59 AM Reply Quote 0
        • R
          Russ @thibou.justin
          last edited by Oct 24, 2021, 1:59 AM

          @thibou-justin,
          I'm glad that worked.
          No, I don't have a donations page - just the annual subscription.

          Russell VanderMey

          1 Reply Last reply Reply Quote 0
          4 out of 4
          • First post
            4/4
            Last post