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

Echo linux command not working when run from the internet, but works on device

General Discussion
2
3
514
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.
  • J
    jackson pollard
    last edited by May 2, 2019, 1:50 PM

    Here's an example of one of the commands I want to run:

    echo "python giveTour.py fullTour" > Desktop/Cram0002/reqs.txt

    Basically just trying to echo a line into a file. It works when I activate the trigger directly on the laptop, but if I activate it using the triggerCMD website or Alexa, the command does nothing. Its not a connection issue either, because if I replace the above command with a different one, it runs correctly. It is only failing for commands that echo something into a file. I can't find any reason these would fail when the triggers work correctly when run on the machine.

    Any help would be appreciated.

    R 1 Reply Last reply May 2, 2019, 11:33 PM Reply Quote 0
    • R
      Russ @jackson pollard
      last edited by Russ May 2, 2019, 11:34 PM May 2, 2019, 11:33 PM

      @jackson-pollard, I was able to reproduce the problem and I figured out why it worked in the GUI but not from the website.

      This is how you can fix it. Just change your command to this:

      echo "python giveTour.py fullTour" > ~/Desktop/Cram0002/reqs.txt
      

      The reason it didn't work is the present working directory is /usr/lib/triggercmdagent/resources/app/src when the command runs remotely, but when you run it locally via the GUI, your present working directory is your home directory.

      So if you just specify your home folder using the ~ character, it finds the correct folder to write the file to.

      Russell VanderMey

      J 1 Reply Last reply May 3, 2019, 12:36 AM Reply Quote 0
      • J
        jackson pollard @Russ
        last edited by May 3, 2019, 12:36 AM

        @russ Thanks a lot, this worked. I shouldn't've assumed it would always run in the home directory. This saved me a lot of headaches.

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