TRIGGERcmd
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login
    1. Home
    2. Joe
    3. Posts
    J
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 20
    • Best 0
    • Controversial 0
    • Groups 0

    Posts made by Joe

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

      Ahhh -- now most of the issues above make sense.

      Simply restated, to see if I get it:

      1 - Only Foreground Triggers work in a user's regular account

      2 - Root can support both Foreground and Background Triggers

      3 - But running Triggers as Root will mask/override all the Triggers in your regular account

      4 - The exception to (3) is if you can instantiate two "Computers" -- one pointing to Root for the "Background", and a separate "Computer" pointing to your normal Linux account to support the "Foreground"

      So how do you setup two Computers -- one for root and one for regular accounts -- pointing to the same physical machine?

      Related: how do you create separate Computers associated with different regular Linux accounts all run on the same machine? e.g. if you wanted anyone logged into a given machine/VM to enjoy the same set of Triggers, would you ONLY install triggercmdagent+ as root so everyone can tie into them?

      Somewhat related: are Linux user accounts the key point of connection to the Mother Ship, or the machines MAC address, or what?

      posted in General Discussion
      J
      Joe
    • RE: Linux VM - TriggerCMD shows messages like it's working, but commands don't actually execute

      Good news, @Russ : I'm back in business with hello_world.sh!

      Interesting news: it took a few more steps in addition to what you noted above. Specifically:

      1 - I deleted the Computer, and deleted the /root/.TRIGGERcmdData directory

      2 - For some reason neither installdaemon.sh nor removedaemon.sh in /usr/share/triggercmdagent/resources/app/src had execute permissions, so I had to sudo chmod 755 both of them to get them to run. (Is this a bug in the RPM, or did I make an install mistake somehow?)

      3 - Now running installdaemon.sh gave me the following promising output:

      [jhupcey@orw-mobile-vm ~]$ sudo sh /usr/share/triggercmdagent/resources/app/src/installdaemon.sh 
      Daemon install: true
      No token exists.  Login to request one.
      prompt: token:  triggercmdagent.service - TRIGGERcmd Agent
         Loaded: loaded (/etc/systemd/system/triggercmdagent.service; enabled)
         Active: active (running) since Wed 2020-05-27 20:23:33 PDT; 106ms ago
       Main PID: 15920 (node)
         CGroup: /system.slice/triggercmdagent.service
                 \u2514\u250015920 node /usr/share/triggercmdagent/resources/app/src/daemon.js --run /root/.TRIGGERcmdData
      
      May 27 20:23:33 orw-mobile-vm systemd[1]: Started TRIGGERcmd Agent.
      [jhupcey@orw-mobile-vm ~]$
      

      3 - Still, a new Computer did not reappear. However, this was not a surprise given the "No token exists. Login to request one." message above.

      4 - Hence, playing a hunch (or if you prefer, shooting in the twilight), I re-ran in my area:

      sudo systemctl start triggercmdagent

      then

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

      which prompted me for my token, which it digested and I got the comforting message with the text sail boat, etc. which finished with "Added Gnome Editor" -- but nothing else was reported as "Added".

      5 - Recalling the "foreground" note in your immediately prior post, I edited my commands.json to have hello_world.sh be a "foreground" thing, and viola! -- it appeared along with Gnome Editor as a Trigger, and executes as expected.

      6 - Oddly, anything listed as "background" doesn't get "Added" or appear in the Triggers. To confirm this, I added back in an entry for Gnome Calculator -- first as "background" -- nada; then as "foreground", which upon saving commands.json produced the message "Added Gnome Calculator" was reported, and it appeared as a Trigger.

      To summarize, my current commands.json file is as follows:

      [jhupcey@orw-mobile-vm ~/.TRIGGERcmdData]$ more commands.json
      [
        {"trigger":"Gnome Editor","command":"gedit","ground":"foreground","voice":"edit","allowParams": "false"},
        {"trigger":"Gnome Calculator","command":"gnome-calculator","ground":"foreground","voice":"calculator","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":"foreground","voice":"hello world","allowParams": "false"}
      ]
      [jhupcey@orw-mobile-vm ~/.TRIGGERcmdData]$
      

      Again, anything listed as "background" does not appear as a trigger.

      That said, since I can now execute a bash script and invoke a program via The System, I'm back-in-business; and this foreground-background distinction is only of academic interest at this point (or am I missing out?)

      Finally, I truly appreciate all your diligent support!!! Many thanks!!!

      posted in General Discussion
      J
      Joe
    • RE: Linux VM - TriggerCMD shows messages like it's working, but commands don't actually execute

      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 ...

      posted in General Discussion
      J
      Joe
    • RE: Linux VM - TriggerCMD shows messages like it's working, but commands don't actually execute

      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

      posted in General Discussion
      J
      Joe
    • RE: Linux VM - TriggerCMD shows messages like it's working, but commands don't actually execute

      @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 ~]$
      
      posted in General Discussion
      J
      Joe
    • RE: Linux VM - TriggerCMD shows messages like it's working, but commands don't actually execute

      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

      posted in General Discussion
      J
      Joe
    • RE: Linux VM - TriggerCMD shows messages like it's working, but commands don't actually execute

      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]$
      
      posted in General Discussion
      J
      Joe
    • RE: Linux VM - TriggerCMD shows messages like it's working, but commands don't actually execute

      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 ...

      posted in General Discussion
      J
      Joe
    • RE: Linux VM - TriggerCMD shows messages like it's working, but commands don't actually execute

      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?

      posted in General Discussion
      J
      Joe
    • RE: Linux VM - TriggerCMD shows messages like it's working, but commands don't actually execute

      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?

      posted in General Discussion
      J
      Joe
    • RE: Linux VM - TriggerCMD shows messages like it's working, but commands don't actually execute

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

      I'll do a reinstall and report back.

      posted in General Discussion
      J
      Joe
    • RE: Linux VM - TriggerCMD shows messages like it's working, but commands don't actually execute

      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

      posted in General Discussion
      J
      Joe
    • RE: Linux VM - TriggerCMD shows messages like it's working, but commands don't actually execute

      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
      posted in General Discussion
      J
      Joe
    • RE: Linux VM - TriggerCMD shows messages like it's working, but commands don't actually execute

      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?

      posted in General Discussion
      J
      Joe
    • RE: Linux VM - TriggerCMD shows messages like it's working, but commands don't actually execute

      Thanks for the detailed update, @Russ !!!

      A) I do now see the "fresh" xxxx.txt in the /root directory after a "sudo su -"

      B ) Doesn't triggercmdagent need to be run as root (certainly it seemed to be a requirement for the install)? If not / presuming your comment on "you'd need to run the agent in an X terminal in foreground mode" means "no root, just run triggercmdagent as 'yourself'", I get this error when I try to run triggercmdagent as me in my home directory:

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

      C) A parallel interpretation of your above comment was to also:
      C.1 -- As root/sudo: edit root's commands.json to make gedit and calc be "foreground"
      C.2 -- As me, do a cut&paste of this revises commands.json into a vi editor, "copy" root's commands.json to /home/<my_user_name>/.TRIGGERcmdData directory so the "new" commands.json will clearly be in my personal account ownership
      C.3 -- Expect that triggercmdagent will pickup on this new, "local" overlay

      This yielded no change in behavior (I got the encouraging trigger message but still no calc popping up), and this I freely acknowledge I am still not getting it unfortunately.

      D) How should I proceed? Do some sort of uninstall, re-install, edit some config file, or what? Help!

      Joe

      posted in General Discussion
      J
      Joe
    • RE: Linux VM - TriggerCMD shows messages like it's working, but commands don't actually execute

      @Russ follow-up question on hello_world.sh:

      When I set the appending to a "hard" directory like /tmp, it works fine

      When I point it to my automounted home area path a-la:

      #!/bin/bash
      echo Hello World >> /home/<my_user_name>/xxxx.txt
      

      nothing happens and/or xxxx.txt doesn't seem to land anywhere.

      Does agent.js / TriggerCMD not like automounted directories?

      posted in General Discussion
      J
      Joe
    • RE: Linux VM - TriggerCMD shows messages like it's working, but commands don't actually execute

      @Russ indeed, the output of hello_world.txt is where you said it would be! Thanks!!!

      Now back to gedit and gnome-calculator:
      Neither the default gedit opening example or the Gnome Calculator example I setup myself are coming up -- I get a message from TriggerCMD in the terminal, but nothing happens. Any ideas?

      posted in General Discussion
      J
      Joe
    • RE: Linux VM - TriggerCMD shows messages like it's working, but commands don't actually execute

      Thanks, @Russ!

      NP on the reply ETA

      In the meantime, toward your initial thought:
      As an experiment I just copied the root commands.json over the local commands.json (they were different - I didn't have the calc in the local one) and "called" hello_world.sh again -- no change in behavior.

      (For reference, this begs the question: Does the agent need to be restarted somehow to pickup on any changes like this because it caches the commands.json, or does it do a fresh re-read of the commands.json every time a command is run?)

      posted in General Discussion
      J
      Joe
    • RE: Linux VM - TriggerCMD shows messages like it's working, but commands don't actually execute

      Edited to add:

      I have also tried making the triggers "foreground" as well as "background" -- no dice either way.

      Help!!!

      Joe

      posted in General Discussion
      J
      Joe
    • Linux VM - TriggerCMD shows messages like it's working, but commands don't actually execute

      Hello!

      As per the attached image, I appear to have TriggerCMD working on a Linux VM -- including TriggerCMD giving me satisfying messages in the terminal window. However, the given action doesn't actually execute.

      In the example below, I have a very simple shell script that appends "Hello World" to a file -- xxxx.txt. When I summon the script via Alexa, I get a message that suggests that it ran:

      $ { trigger: 'hello world', id: '5ec1f4d3c65a9d001992532f' }

      but as you can see nothing was added to xxxx.txt by this. However, when I run this script manually, it works.

      Note that both the default gedit opening example -- and a separate Gnome Calculator example I setup myself -- both exhibit the same behavior: I get a message from TriggerCMD in the terminal, but nothing happens.

      In case you can't read it in the attached image of the terminal, here is the root JSON file:

      $ sudo more /root/.TRIGGERcmdData/commands.json
      [
      {"trigger":"Gnome Editor","command":"gedit","ground":"background","voice":"edit","allowParams": "false"},
      {"trigger":"Gnome Calculator","command":"gnome-calculator","ground":"background","voice":"calculator","allowParams": "false"},
      {"trigger":"hello world","command":"/home/jhupcey/hello_world.sh","ground":"background","voice":"hello world","allowParams": "false"}
      ]

      And here is uname -a of the Linux install:
      $ uname -a
      Linux orw-mobile-vm 3.10.0-229.14.1.el7.x86_64 #1 SMP Tue Aug 25 11:21:22 EDT 2015 x86_64 x86_64 x86_64 GNU/Linux

      where "orw-mobile-vm" is the name of the VM instance.

      I'm sooooo close to getting this working -- what am I missing?

      Help!!!

      Joe

      triggercmd-linux-issue.JPG

      posted in General Discussion
      J
      Joe