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

    Linux Server - No GUI - Add Background commands

    General Discussion
    6
    16
    4.5k
    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.
    • RussR
      Russ @laakness
      last edited by

      @laakness, I wonder if this is what you're missing. You're running a script instead of a command in one of the folders in your PATH, so you have to specify the folder where the script lives. AND, because commands.json has to be in json format, you have to escape your forward slashes with backslashes. Here's the basic format. Notice the \'s

      {"trigger":"My Awesome Script","command":"\/root\/coolscript.sh","ground":"background","voice":"awesome"},
      

      Russell VanderMey

      L 1 Reply Last reply Reply Quote 0
      • L
        laakness @Russ
        last edited by

        @russ Thanks. That does help for the formatting of the command but what I'm asking is where do I actually configure that from a server with no GUI?

        I tried to edit the commands.json but it gets overwritten once the service is restarted.

        Where do I actually configure the commands, I'm not seeing it in the web and most of the examples on the site show the Windows GUI.

        RussR 1 Reply Last reply Reply Quote 0
        • RussR
          Russ @laakness
          last edited by

          @laakness, I see. Your commands.json file will get over-written if it has bad json formatting in it. That's why I like the GUI because it handles the json formatting for you.

          One common mistake that can mess up json is having a comma at the end of the last record.

          If you copy/paste your json data here (before it gets over-written) I could probably spot the problem.

          Or, you could use https://jsonformatter.curiousconcept.com to check your json.

          Russell VanderMey

          L 1 Reply Last reply Reply Quote 0
          • L
            laakness @Russ
            last edited by

            @russ you are the man.

            That was it, I was missing a comma. You'd think after working with kubernetes and yaml files all week I would have run it through a format validator 🙂

            Nice work on this app btw.

            RussR 1 Reply Last reply Reply Quote 0
            • RussR
              Russ @laakness
              last edited by

              Thanks @laakness. I'm learning Kubernetes myself.

              I made this video showing it off: https://www.youtube.com/watch?v=MyvRFbHErJQ

              Russell VanderMey

              1 Reply Last reply Reply Quote 0
              • ?
                A Former User
                last edited by

                This not only runs the process in background, also generates a log (called .... You put a command in the background by adding & after the command: ... bad connection to the server

                RussR 1 Reply Last reply Reply Quote 0
                • RussR
                  Russ @A Former User
                  last edited by

                  @asussupport, please clarify. Are you getting an error?

                  Russell VanderMey

                  1 Reply Last reply Reply Quote 0
                  • ?
                    A Former User
                    last edited by

                    How do I run a program in the background of a shell, with the ability to close the shell while leaving the program running? Lets say my UI is having problems or for some reason, I need to boot up a program from the terminal window???

                    RussR 1 Reply Last reply Reply Quote 0
                    • RussR
                      Russ @A Former User
                      last edited by

                      @asussupport, take a look at the screen program. That might be what you're looking for. Otherwise, please tell me more about what you're trying to accomplish.

                      Russell VanderMey

                      1 Reply Last reply Reply Quote 0
                      • F
                        fhcat9
                        last edited by

                        Hi, I run into the same problem today. I tried to edit the file named linuxcommands.json, it is under /usr/lib/triggercmdagent/resources/app/src. I added a command, but I am not seeing it on my command list. Here is my file:
                        [
                        {"trigger":"Reboot","command":"shutdown -r","ground":"background","voice":"reboot","allowParams": "false"},
                        {"trigger":"Gnome Editor","command":"gedit","ground":"foreground","voice":"edit","allowParams": "false"},
                        {"trigger":"yum update","command":"yum -y update","ground":"background","voice":"yum update","allowParams": "false"},
                        {"trigger":"apt update","command":"apt-get -y update","ground":"background","voice":"update","allowParams": "false"},
                        {"trigger":"touch file","command":"echo "haha" > /home/fhcat/triggercmd.file","ground":"background","voice":"touch file","allowParams": "false"}
                        ]

                        RussR 1 Reply Last reply Reply Quote 0
                        • RussR
                          Russ @fhcat9
                          last edited by

                          @fhcat9, that's the wrong file to edit. That's just the list of default commands. That linuxcommands.json file gets copied to ~/.TRIGGERcmdData/commands.json when you start the agent for the first time.

                          You want to be editing your ~/.TRIGGERcmdData/commands.json file instead.

                          Russell VanderMey

                          F 1 Reply Last reply Reply Quote 0
                          • F
                            fhcat9 @Russ
                            last edited by

                            @russ Thanks! Now I can begin customize my commands on my OrangePi. BTW, the Ubuntu instructions probably needs some update. I installed the latest Non-Gui package and some of my steps are different. For example, for me, the agent directory is /usr/lib/triggercmdagent/resources/app/src/agent.js, not /usr/share/triggercmdagent/resources/app/src/agent.js. And on my Ubuntu 16.04, it is nodejs /usr/lib/triggercmdagent/resources/app/src/agent.js --console as node is deprecated.

                            1 Reply Last reply Reply Quote 0
                            • J
                              JimmieRhone
                              last edited by

                              This not only runs the process in background, also generates a log (called .... You put a command in the background by adding & after the command: ... bad connection to the server
                              https://www.puttygen.com/linux-commands

                              1 Reply Last reply Reply Quote 0
                              • Ruan BarrosR
                                Ruan Barros
                                last edited by

                                @Russ I cant add commands when I create and edit commands.json in ./TRIGGERcmd-agent. Simply, the software are ignoring my file "commands.json". Probally, I make something wrong, but I dont know what can be.

                                output when I restart connection with the web service with command.js on folder:

                                { message: 'Subscribed to 60dd332cb1a3e2001a6edf39!' }
                                { message: 'Subscribed to 60dd332cb1a3e2001a6edf39!' }
                                Added Gnome Editor

                                System: endeavour-OS

                                When I simply restart the software, with some updates on commands.json:

                                { message: 'Subscribed to 60dd332cb1a3e2001a6edf39!' }
                                { message: 'Subscribed to 60dd332cb1a3e2001a6edf39!' }

                                I'm not using gui, only terminal version.

                                RussR 1 Reply Last reply Reply Quote 0
                                • RussR
                                  Russ @Ruan Barros
                                  last edited by

                                  @Ruan-Barros, it looks like it added the Gnome Editor command the first time, and the second time it found that Gnome Editor is the only foreground command in you commands.json file so it didn't need to add anything new - Gnome Editor was already added to your computer in your account. You're running the agent in foreground mode so it will ignore any commands with ground = background.

                                  If you click the green Trigger button for Gnome Editor it will probably try to run it. You should see that in your agent output.

                                  Russell VanderMey

                                  1 Reply Last reply Reply Quote 0
                                  • First post
                                    Last post