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

Commands marked as executed, but nothing happens

General Discussion
linux launching apps foreground service help needed
2
5
498
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.
  • A
    aandrews
    last edited by Sep 9, 2023, 12:52 PM

    Hello, I am having an issue with the triggercmd agent on Arch Linux (I have sort of a custom installation, I built the project from the GitHub source, then created two systemd units, for both background and foreground services).
    I am trying to run applications saying "Alexa, turn on steam" for example. I have thus inserted into commands.json:

    {"trigger": "steam", "command": "/usr/bin/steam", "ground": "foreground", "voice": "steam", "allowParams": "false"}
    

    when I ask Alexa to run the command and check the logs via systemctl status, I get that the command ran

    this is consistent with the fact that simpler background commands like shutting down or rebooting the pc work as intended and show up as well.

    Am I missing something?

    R 1 Reply Last reply Sep 10, 2023, 6:34 PM Reply Quote 0
    • R
      Russ @aandrews
      last edited by Russ Sep 10, 2023, 6:36 PM Sep 10, 2023, 6:34 PM

      @aandrews, I think it's executing in your foreground agent, but because you're running it inside a systemd service, it's either failing because it can't find X-Windows because the DISPLAY environment variable isn't set in that context, or it is but you haven't run xhost + so it doesn't have access to display steam in X-Windows, or it's getting some other error. You could probably see the error if you change your command to this:

      /usr/bin/steam > /tmp/steam.log 2>&1
      

      If you want to set the DISPLAY environment variable before running steam, you could use a script like this:

      #!/bin/bash
      export DISPLAY=:0.0
      /usr/bin/steam > /tmp/steam.log 2>&1
      

      Russell VanderMey

      A 1 Reply Last reply Sep 11, 2023, 1:46 PM Reply Quote 0
      • A
        aandrews @Russ
        last edited by Sep 11, 2023, 1:46 PM

        @Russ this was incredibly helpful. I didn't pay the attention I should have, because I had simply put a

        /usr/bin/steam > /tmp/steam.log 
        

        while debugging, assuming the > operator without specifying 1 or 2 before would redirect both stout and stderr to the file, and I predictably didn't get any error in the output this way..

        either way, even getting the correct error log, I wouldn't have been able to resolve the issue without your help so thank you again. One more issue that I hope you might know how to fix is that I can now launch all my apps, but they have no audio. This time there is actually no error indication but maybe there's some additional configuration I need to do, would you know anything about it? I hope I am not pestering the forum with dumb questions but I truly can't manage to find a solution elsewhere

        R 1 Reply Last reply Sep 11, 2023, 9:43 PM Reply Quote 0
        • R
          Russ @aandrews
          last edited by Sep 11, 2023, 9:43 PM

          @aandrews, I suspect the command is running as root and audio is disabled for root.

          You could run the your steam command as your non-root user like this:

          su - aandrews -c "/usr/bin/steam > /tmp/steam.log 2>&1"
          

          Alternatively, you could enable audio for root. Here are some links about that:
          https://bbs.archlinux.org/viewtopic.php?id=263796
          https://wiki.archlinux.org/title/PulseAudio

          Russell VanderMey

          A 1 Reply Last reply Sep 12, 2023, 2:24 PM Reply Quote 0
          • A
            aandrews @Russ
            last edited by Sep 12, 2023, 2:24 PM

            @Russ It makes sense, thank you again. I will try this as soon as possible but I'm hopeful it'll finally work as I intended

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