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

    trigger ssh command on raspberry pi

    Scheduled Pinned Locked Moved Raspberry Pi
    4 Posts 2 Posters 1.5k Views 1 Watching
    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.
    • thibou.justinT Offline
      thibou.justin
      last edited by

      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?

      RussR 1 Reply Last reply Reply Quote 0
      • RussR Online
        Russ @thibou.justin
        last edited by

        @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
        • thibou.justinT Offline
          thibou.justin
          last edited by

          @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

          RussR 1 Reply Last reply Reply Quote 0
          • RussR Online
            Russ @thibou.justin
            last edited by

            @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

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            • First post
              Last post