Triggers running but command not executing
-
I just installed triggercmd on my Ubuntu 18.04 headless via SSH. After some fiddling, I got the software installed properly and edited the ~./TRIGGERcmdData/commands.json file and added the following line:
{"trigger":"touch","command":"touch foo /test","ground":"foreground","voice":"update","allowParams": "false"}
I started the agent via the "triggercmdagent" command and see the command populated to the website. When I click the Trigger button on the website, it states that the command ran but there is no file in /test/ created called "foo". I checked the journalctl logs and it shows the same details as the agent but nothing ran. The permissions on /test/ are 777 so this isn't a permissions issue. I tried various other commands like just opening "nano" and it's not running either.
Is there anywhere I can find out why the command isn't running?
Here is a list of the details showing in the triggercmdagent window:
$ triggercmdagent
Run installdaemon.sh to install the triggercmdagent daemon so it runs during boot
Daemon install: false
Logging in with saved token.
Checking if the XXXXXXXXXXXXXXXXXXXX computer exists.
This computer exists in your account.
Tokenfile: /home/XXXXXXXX/.TRIGGERcmdData/token.tkn
ComputerIDfile: /home/XXXXXXXXX/.TRIGGERcmdData/computerid.cfg
Logging in with saved token to run foreground 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.1.13)
Connected at: Wed Jun 12 2019 11:29:49 GMT-0400 (EDT)Initiated command removals
{ message: 'Subscribed to XXXXXXXXXXXXXXXXXXXXXX' }
{ message: 'Subscribed to XXXXXXXXXXXXXXXXXXXXXX' }
Initiated command adds
{ trigger: 'touch', id: 'YYYYYYYYYYYYYYYYYYY' }
Running trigger: touch Command: touch foo /test
Reported: Command Ran -
@xtropy, will you please trying this as your command?
touch /test/foo
When I ran your command manually, it created a foo file in my current directory, and a /test file in my / directory. I don't think that's the result you're looking for.
When I created a /test fodler, then ran touch /test/foo via TRIGGERcmd it worked - it created a foo file in /test.
Also I think you're aware of this already, but just in case - remember the daemon adds and runs background commands, and when you triggercmdagent interactively, it will run foreground commands.
-
Thanks Russ. That worked. I was trying various commands like trying to run "nano" and it didn't pop-up so figured there were bigger issues at play. Since I am not running in an X environment, I'm assuming the commands run in a random virtual console? I was running foreground to get visibility and troubleshooting from the logs. I just modified the commands.json line for this to background and started the daemon and this also worked.
Not a lot of documentation for using triggercmd via command line (ssh) and most is focused on the GUI so fumbling may way around :). Thanks again for the reply. Now that I know commands are running correctly, I'll play around with the scripts I want to run. Great program BTW