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

Linux VM - TriggerCMD shows messages like it's working, but commands don't actually execute

General Discussion
2
33
3.0k
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.
  • R
    Russ @Joe
    last edited by Russ May 21, 2020, 10:45 PM May 21, 2020, 10:44 PM

    @Joe, why did you add a & to the end of the triggercmdagent command? If you leave that off, it should run the agent in foreground mode and you'll be able to see the output.

    Please try running triggercmdagent in an xterm window as yourself, and trigger your foreground commands on the computer in your account that got created when you ran it as yourself (not the one created when you ran it as root).

    If you want to start from scratch, there's no need to re-install. Just delete the ~/.TRIGGERcmdData folder, and the computer in your account that matches the ID in ~/.TRIGGERcmdData/computerid.cfg. Then when you run triggercmdagent, it will prompt you again for your token, then create a new computer and .TRIGGERcmdData folder.

    Russell VanderMey

    1 Reply Last reply Reply Quote 0
    • J
      Joe
      last edited by May 21, 2020, 11:13 PM

      Regarding:
      why did you add a & to the end of the triggercmdagent command?

      Force of habit. Apologies.

      Looking to start from scratch per your guidelines:

      • I deleted the ~/.TRIGGERcmdData folder in my home area

      • I also went my https://www.triggercmd.com/user/computer/list and deleted the Linux VM I'd been working with

      • Next, I run % triggercmdagent in the foreground, but I get the following error almost immediately:

      [jhupcey@orw-mobile-vm ~]$ triggercmdagent
      /usr/share/triggercmdagent/triggercmdagent: symbol lookup error: /usr/share/triggercmdagent/triggercmdagent: undefined symbol: gtk_widget_get_scale_factor
      [jhupcey@orw-mobile-vm ~]$
      

      What next?

      J 1 Reply Last reply May 22, 2020, 12:18 AM Reply Quote 0
      • J
        Joe @Joe
        last edited by May 22, 2020, 12:18 AM

        Edited to add: presuming there are no more easy tweaks to be made here, I'm willing to do a complete re-install from scratch and potentially save us all some time. Please advise.


        While I have the floor: FYI, some background on my objectives here:

        • The baseline need is to launch a program tool from the command line with an Alexa voice command in my Linux VM
        • Next, once the given tool(s) GUIs are open, I'd use voice commands to launch pre-made "do files" to execute specific flows in the tool(s)
        • In a perfect world, I'd also be able to map Alexa voice commands to "macros of menu commands" similar to what you can do with WSH in MS Windows
        R 1 Reply Last reply May 22, 2020, 1:15 AM Reply Quote 0
        • R
          Russ @Joe
          last edited by May 22, 2020, 1:15 AM

          @Joe, you might want to try a fresh VM or uninstall/reinstall because I'm not familiar with that gtk_widget_get_scale_factor error.

          Another way to run the agent is this:

          node /usr/share/triggercmdagent/resources/app/src/agent.js --console
          

          That path assumes Ubuntu. If that works, you might be able to salvage your install.

          Russell VanderMey

          1 Reply Last reply Reply Quote 0
          • J
            Joe
            last edited by May 22, 2020, 1:33 AM

            Thanks, @Russ !

            The VM is Red Hat Enterprise 7.1, but I tried the "node" command you cited above anyway.

            The result:

            • a new "Computer" did appear in https://www.triggercmd.com/user/computer/list, but no Triggers appeared.
            • Interesting that Alexa still gave me a hearty "Ok" when I asked for "Hello World" and "Calculator", but nothing happened

            At this point I think it's best to go ahead and do a full UNinstall, contemplate all the advice you've provided above, then do a fresh reinstall.

            Any tips for a complete, scorched earth TriggerCMD UNinstall on this Red Hat Linux VM before I do a reinstall?


            P.S. For anyone else following this thread, my TriggerCMD instances on my Raspberry Pi and MS Windows machine are doing fine. I think this Linux dust-up is simply due to my relative inexperience dealing with a Red Hat VM distro

            R 1 Reply Last reply May 22, 2020, 12:15 PM Reply Quote 0
            • R
              Russ @Joe
              last edited by May 22, 2020, 12:15 PM

              @Joe, it could be that the reason Alexa said "OK" was you're using the Smart Home skill and she still thinks you have some "devices" there. The way to fix that is to go here and click Remove All, then Discover. I've done my best to synchronize the commands with your Alexa devices, but there are still scenarios where they can get out of sync. This is one reason you should test in this order:

              1. Use the green play button in the GUI editor if you're using it.
              2. Use the green Trigger button on the website.
              3. Use Alexa

              You could try this procedure to re-install the agent, but you might need something more dramatic, like a fresh VM.

              Russell VanderMey

              1 Reply Last reply Reply Quote 0
              • J
                Joe
                last edited by May 22, 2020, 4:28 PM

                Thanks again, @Russ for the support and the added tech tips!

                I'll do a reinstall and report back.

                1 Reply Last reply Reply Quote 0
                • J
                  Joe
                  last edited by May 23, 2020, 10:21 PM

                  Update: unfortunately, no luck on the re-install of the triggercmdagent-1.0.1.x86_64.rpm

                  First, I'm not seeing the Linux VM "Computer" getting re-listed in https://www.triggercmd.com/user/computer/list

                  When I run triggercmd agent as me after the re-install I get the now familiar error:

                  [jhupcey@orw-mobile-vm ~]$ triggercmdagent
                  /usr/share/triggercmdagent/triggercmdagent: symbol lookup error: /usr/share/triggercmdagent/triggercmdagent: undefined symbol: gtk_widget_get_scale_factor
                  [jhupcey@orw-mobile-vm ~]$
                  

                  For the heck of it I also have logged into another window as root, and executing triggercmdagent in /root does nothing. For curiosities sake / playing a hunch, I cd'ed into .TRIGGERcmdData, and ran the triggercmdagent.service, and at least I get the following more promising error messages:

                  [root@orw-mobile-vm ~]# 
                  [root@orw-mobile-vm ~]# pwd
                  /root
                  [root@orw-mobile-vm ~]# cd .TRIGGERcmdData/
                  [root@orw-mobile-vm .TRIGGERcmdData]# ls -la
                  total 32
                  drwxr-xr-x   2 root root 4096 May 23 15:06 .
                  dr-xr-x---. 23 root root 4096 May 23 14:52 ..
                  -rw-r--r--   1 root root  384 May 20 22:31 commands.json
                  -rw-r--r--   1 root root  384 May 23 15:06 commands.json.backup
                  -rw-r--r--   1 root root   24 May 17 19:07 computerid.cfg
                  -rw-r--r--   1 root root  516 May 17 19:07 sendresult.sh
                  -rw-r--r--   1 root root  148 May 17 19:07 token.tkn
                  -rwxr-xr-x   1 root root  230 May 17 19:26 triggercmdagent.service
                  [root@orw-mobile-vm .TRIGGERcmdData]# ./triggercmdagent.service 
                  ./triggercmdagent.service: line 1: [Unit]: command not found
                  ./triggercmdagent.service: line 2: Agent: command not found
                  ./triggercmdagent.service: line 4: [Service]: command not found
                  Running Linux daemon to run background tasks.
                  Run installdaemon.sh to install the triggercmdagent daemon so it runs during boot
                  Tokenfile: /root/.TRIGGERcmdData/token.tkn
                  ComputerIDfile: /root/.TRIGGERcmdData/computerid.cfg
                  Logging in with saved token to run background tasks.
                  Write backup completed.
                  
                  
                    |>    Now connected to https://www.triggercmd.com.
                  \___/   For help, see: http://bit.ly/2q0QDpf
                          (using sails.io.js node SDK @v1.2.1)
                           Connected at: Sat May 23 2020 15:19:16 GMT-0700 (PDT)
                  
                  
                  
                  Initiated command removals
                  { message: 'Subscribed to 5ec1edf375b86f0019cd1a2c!' }
                  { message: 'Subscribed to 5ec1edf375b86f0019cd1a2c!' }
                  Initiated command adds
                  Failed while trying add a trigger.
                  

                  Am I getting any closer, or am I just embarrassing myself at this point?

                  R 1 Reply Last reply May 23, 2020, 11:06 PM Reply Quote 0
                  • R
                    Russ @Joe
                    last edited by Russ May 23, 2020, 11:19 PM May 23, 2020, 11:06 PM

                    @Joe, can you try this command? After googling that error I think it's basically saying it can't run the Chromium based GUI portion of the agent. This command runs the agent without the GUI:

                    triggercmdagent --console
                    

                    Also I saw that it couldn't add a trigger. To fix that you could start fresh by deleting your .TRIGGERcmdData folder and the computer in your account.

                    Russell VanderMey

                    1 Reply Last reply Reply Quote 0
                    • J
                      Joe
                      last edited by Joe May 23, 2020, 11:23 PM May 23, 2020, 11:20 PM

                      Here is the result (run as me, not as root -- for root nothing happens):

                      [jhupcey@orw-mobile-vm ~]$ triggercmdagent --console
                      squirrelEvent --console
                      /usr/share/triggercmdagent/triggercmdagent --console: symbol lookup error: /usr/share/triggercmdagent/triggercmdagent --console: undefined symbol: gtk_widget_get_scale_factor
                      [jhupcey@orw-mobile-vm ~]$
                      

                      Possibly related: looking at the timestamps in /root/.TRIGGERcmdData (above) all the timestamps are from the initial install. My point being: whatever I run as me, does it get superceeded by this "stale" root stuff ? Hence, to do a pure UNinstall, should I do some sort of "rm -r" all this, stop some systemctl service, rm -r the <my_home>/.TRIGGERcmdData?

                      1 Reply Last reply Reply Quote 0
                      • J
                        Joe
                        last edited by May 23, 2020, 11:28 PM

                        Update: apologies -- I didn't see the second part of your prior comment.

                        I will delete both the root and my .TRIGGERcmdData folders and start over.

                        Stay tuned ...

                        1 Reply Last reply Reply Quote 0
                        • J
                          Joe
                          last edited by May 23, 2020, 11:51 PM

                          Update:
                          So I blew away the root and my own .TRIGGERcmdData directories, and did a fresh "yum" install. It asked me for my token, etc.

                          The good news is the "Computer" as reappeared in the list. However, no triggers are there.

                          Back on the Linux VM:

                          I still get the familiar error message:

                          [jhupcey@orw-mobile-vm ~]$ triggercmdagent --console
                          squirrelEvent --console
                          /usr/share/triggercmdagent/triggercmdagent --console: symbol lookup error: /usr/share/triggercmdagent/triggercmdagent --console: undefined symbol: gtk_widget_get_scale_factor
                          [jhupcey@orw-mobile-vm ~]$
                          

                          and I also tried running agent.js directly as noted above, and got this:

                          [jhupcey@orw-mobile-vm src]$ pwd
                          /usr/share/triggercmdagent/resources/app/src
                          [jhupcey@orw-mobile-vm src]$ 
                          [jhupcey@orw-mobile-vm src]$ node agent.js --console
                          Run installdaemon.sh to install the triggercmdagent daemon so it runs during boot
                          Daemon install: false
                          Logging in with saved token.
                          Checking if the  computer exists.
                          This computer exists in your account.
                          Tokenfile: /home/jhupcey/.TRIGGERcmdData/token.tkn
                          ComputerIDfile: /home/jhupcey/.TRIGGERcmdData/computerid.cfg
                          Logging in with saved token to run foreground tasks.
                          SyntaxError: Unexpected end of JSON input
                              at Object.parse (native)
                              at updateCmds (/usr/share/triggercmdagent/resources/app/src/agent.js:429:24)
                              at /usr/share/triggercmdagent/resources/app/src/agent.js:274:5
                              at initFiles (/usr/share/triggercmdagent/resources/app/src/agent.js:124:3)
                              at foreground (/usr/share/triggercmdagent/resources/app/src/agent.js:270:3)
                              at /usr/share/triggercmdagent/resources/app/src/agent.js:164:13
                              at Request._callback (/usr/share/triggercmdagent/resources/app/src/agent.js:239:11)
                              at Request.self.callback (/usr/share/triggercmdagent/resources/app/node_modules/request/request.js:185:22)
                              at emitTwo (events.js:106:13)
                              at Request.emit (events.js:191:7)
                          Restoring the last known good file
                          Restore backup completed.
                          [jhupcey@orw-mobile-vm src]$
                          
                          1 Reply Last reply Reply Quote 0
                          • J
                            Joe
                            last edited by May 24, 2020, 12:02 AM

                            Edited to add, since the above called out a JSON error, be advised I haven't touched commands.json in either root or my home area

                            The root commands.json is the default from the install, and the commands.json in my area is 0 bytes/empty

                            R 1 Reply Last reply May 24, 2020, 12:11 AM Reply Quote 0
                            • R
                              Russ @Joe
                              last edited by Russ May 24, 2020, 12:12 AM May 24, 2020, 12:11 AM

                              @Joe, I'm glad you tried running node agent.js --console

                              That's very strange that it couldn't parse the commands.json file. Please try this:

                              cp /usr/share/triggercmdagent/resources/app/src/linuxcommands.json /home/jhupcey/.TRIGGERcmdData/commands.json
                              

                              Then re-run that node agent.js --console command.

                              Also, please show me the output of this command. I'd like to know what version of node js you're running:

                              node -v
                              

                              Russell VanderMey

                              1 Reply Last reply Reply Quote 0
                              • J
                                Joe
                                last edited by Joe May 24, 2020, 6:29 AM May 24, 2020, 6:28 AM

                                @Russ, here are the results -- all run as me in my home directory:

                                [jhupcey@orw-mobile-vm ~]$ pwd
                                /home/jhupcey
                                [jhupcey@orw-mobile-vm ~]$ 
                                [jhupcey@orw-mobile-vm ~]$ cp /usr/share/triggercmdagent/resources/app/src/linuxcommands.json /home/jhupcey/.TRIGGERcmdData/commands.json
                                [jhupcey@orw-mobile-vm ~]$ node agent.js --console
                                module.js:471
                                    throw err;
                                    ^
                                
                                Error: Cannot find module '/home/jhupcey/agent.js'
                                    at Function.Module._resolveFilename (module.js:469:15)
                                    at Function.Module._load (module.js:417:25)
                                    at Module.runMain (module.js:604:10)
                                    at run (bootstrap_node.js:393:7)
                                    at startup (bootstrap_node.js:150:9)
                                    at bootstrap_node.js:508:3
                                [jhupcey@orw-mobile-vm ~]$ node -v
                                v6.10.2
                                [jhupcey@orw-mobile-vm ~]$
                                
                                R 1 Reply Last reply May 24, 2020, 11:58 AM Reply Quote 0
                                • R
                                  Russ @Joe
                                  last edited by Russ May 24, 2020, 4:02 PM May 24, 2020, 11:58 AM

                                  @Joe, sorry I meant for you to be in the src directory when you run the agent.js file like you where earlier.

                                  That node version seems old. I'll try that version myself and see if I get a .json parse problem.

                                  EDIT: I tried node v6.10.2 and it worked fine for me, so that's not the reason for the .json parsing problem.

                                  Russell VanderMey

                                  1 Reply Last reply Reply Quote 0
                                  • J
                                    Joe
                                    last edited by May 25, 2020, 6:34 AM

                                    Thanks for the update, @Russ!

                                    First, this isn't super urgent, so please enjoy the holiday weekend and we'll reconnect Tuesday

                                    Since I had basic functionality working before the "uninstall" (which I could live with at a "work around" level of functionality to get my project going), it suggests that the uninstall process / guidelines are missing steps to get me back to time zero. Hence, I ask, before I do another fresh RPM re-install:

                                    • What are all the directories and files I need to remove -- both in the root areas, and in a user home area?

                                    • What daemons and other processes need to be killed?

                                    Joe

                                    R 1 Reply Last reply May 25, 2020, 12:57 PM Reply Quote 0
                                    • R
                                      Russ @Joe
                                      last edited by May 25, 2020, 12:57 PM

                                      @Joe, I enjoy doing this - I don't mind doing it on a holiday.

                                      Here are the steps I think should be adequate to start from scratch:

                                      sudo su -
                                      systemctl stop triggercmdagent
                                      /usr/share/triggercmdagent/resources/app/src/removedaemon.sh
                                      yum remove triggercmdagent
                                      rm -rf /usr/share/triggercmdagent
                                      rm -rf /root/.TRIGGERcmdData
                                      rm -rf /home/(your user)/.TRIGGERcmdData
                                      

                                      Russell VanderMey

                                      1 Reply Last reply Reply Quote 0
                                      • J
                                        Joe
                                        last edited by May 27, 2020, 4:21 AM

                                        Update:

                                        • I did a scorched earth deletion as listed above, plus did "ps -aux | grep cmd" to find and kill any remaining processes

                                        • I did the yum install (systemctl seemed to need to be run under sudo in order to work), got asked for my token, etc.

                                        • I also went to /usr/share/triggercmdagent/resources/app/src to run installdaemon.sh (which needed sudo to be happy)

                                        The good news:

                                        • The "Computer" re-appeared in https://www.triggercmd.com/user/computer/list !

                                        • In the "Trigger" list, the Gnome Editor appears, and in-fact fires up perfectly when I click the green "Trigger" button! Yeah!

                                        Now, the less good news:

                                        • ONLY the the Gnome Editor appears in the Trigger list, despite my local/personal commands.json being setup as follows (where I deleted the "Reboot" trigger, and added in my hello_world.sh script):
                                        [jhupcey@orw-mobile-vm ~/.TRIGGERcmdData]$ pwd
                                        /home/jhupcey/.TRIGGERcmdData
                                        [jhupcey@orw-mobile-vm ~/.TRIGGERcmdData]$ 
                                        [jhupcey@orw-mobile-vm ~/.TRIGGERcmdData]$ more commands.json
                                        [
                                          {"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":"hello world","command":"\/home\/jhupcey\/hello_world.sh","ground":"background","voice":"hello world","allowParams": "false"}
                                        ]
                                        [jhupcey@orw-mobile-vm ~/.TRIGGERcmdData]$
                                        

                                        Incidentally, when I save this file, I get the following promising messages:

                                        [jhupcey@orw-mobile-vm ~/.TRIGGERcmdData]$ vi commands.json
                                        [jhupcey@orw-mobile-vm ~/.TRIGGERcmdData]$ Write backup completed.
                                        Initiated command removals
                                        Initiated command adds
                                        
                                        [jhupcey@orw-mobile-vm ~/.TRIGGERcmdData]$
                                        

                                        FWIW, the commands.json in the root area (that the installdaemon.sh seemed to generate ) is the default:

                                        [root@orw-mobile-vm .TRIGGERcmdData]# pwd
                                        /root/.TRIGGERcmdData
                                        [root@orw-mobile-vm .TRIGGERcmdData]# more commands.json 
                                        [
                                          {"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"}
                                        ]
                                        [root@orw-mobile-vm .TRIGGERcmdData]#
                                        

                                        Again, one would expect to see the extra triggers on the Computer webpage -- not just the Gnome Editor trigger -- given either of these commands.json

                                        So close ...

                                        R 1 Reply Last reply May 27, 2020, 12:04 PM Reply Quote 0
                                        • R
                                          Russ @Joe
                                          last edited by Russ May 28, 2020, 11:16 PM May 27, 2020, 12:04 PM

                                          @Joe, I can explain why you're only seeing Gnome Editor.

                                          The foreground agent only runs, adds, and removes foreground commands. Gnome Editor is a foreground command. You're only running the foreground agent.

                                          You seem to have run the foreground agent under root too, which would have added a second computer with a different computer ID. You can see the ID in ~/.TRIGGERcmdData/computerid.cfg. Then you installed the background agent under root using root's home directory by running installdaemon.sh as root.

                                          You should delete the /root/.TRIGGERcmdData directory and the corresponding computer record in your account, so all you have is the /home/jhupcey/.TRIGGERcmdData/computerid.cfg computer. Then, while logged in as jhupcey, I think if you run this, it will install the background agent and configure it to use /home/jhupcey/.TRIGGERcmdData:

                                          sudo sh /usr/share/triggercmdagent/resources/app/src/removedaemon.sh
                                          sudo sh /usr/share/triggercmdagent/resources/app/src/installdaemon.sh
                                          

                                          I don't have time to test this right now - I can later today though. I realize I need to do that and produce some better documentation on this. Sorry about that.

                                          EDIT: I downloaded the Centos DVD. I'll install it and test this tomorrow.

                                          Russell VanderMey

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