TriggerCMD on Ubuntu Server 20.04 background service
-
Hi! I just found out about this neat software, and it looks like it could solve some of my problems, but I got some issues while installing/configure.
I follow your this guide: Ubuntu Linux agent instructions and everything gets installed correctly at first, but I can't get the daemon to run, and none of my foreground or background triggers is showing up on the webpage. Only "Gnome Editor" is showing up. I also tried to add some more foreground triggers in the commands.jason file, but nothing is working. When I trigger the "Gnome Editor" example my server reports that it have triggered correctly. (I've removed the computer ID from the code below, did not know if it was sensitive) I really need some guidence here
ComputerIDfile: /home/rustserver/.TRIGGERcmdData/computerid.cfg Logging in with saved token to run foreground tasks. Computer ID xxxxxxxxxx saved for next time. 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: Thu Oct 29 2020 20:02:59 GMT+0000 (Coordinated Universal Time) Initiated command removals Initiated command adds { message: 'Subscribed to xxxxxx!' } { message: 'Subscribed to xxxxxx!' } Added Gnome Editor SyntaxError: Unexpected token { in JSON at position 461 at JSON.parse (<anonymous>) at updateCmds (/usr/lib/triggercmdagent/resources/app/src/agent.js:429:24) at Timeout._onTimeout (/usr/lib/triggercmdagent/resources/app/src/agent.js:710:9) at ontimeout (timers.js:436:11) at tryOnTimeout (timers.js:300:5) at listOnTimeout (timers.js:263:5) at Timer.processTimers (timers.js:223:10) Restoring the last known good file Restore backup completed. Write backup completed. Initiated command removals Initiated command adds sudo sh /usr/lib/triggercmdagent/resources/app/src/installdaemon.sh Daemon install: true No token exists. Login to request one. ● triggercmdagent.service - TRIGGERcmd Agent Loaded: loaded (/etc/systemd/system/triggercmdagent.service; enabled; vendor preset: enabled) Active: active (running) since Thu 2020-10-29 20:09:35 UTC; 531ms ago Main PID: 7538 (node) Tasks: 6 (limit: 9765) Memory: 5.1M CGroup: /system.slice/triggercmdagent.service └─7538 node /usr/lib/triggercmdagent/resources/app/src/daemon.js --run /root/.TRIGGERcmdData systemctl status triggercmdagent ● triggercmdagent.service - TRIGGERcmd Agent Loaded: loaded (/etc/systemd/system/triggercmdagent.service; enabled; vendor preset: enabled) Active: failed (Result: start-limit-hit) since Thu 2020-10-29 20:10:55 UTC; 3min 30s ago Main PID: 7943 (code=exited, status=0/SUCCESS)
When I test the "Gnome Editor" example it triggers:
Write backup completed. Initiated command removals Initiated command adds { trigger: 'Gnome Editor', id: 'xxxxxxxxx' } Running trigger: Gnome Editor Command: gedit Reported: Command Ran
-
@julianbr said in TriggerCMD on Ubuntu Server 20.04 background service:
SyntaxError: Unexpected token { in JSON at position 461
at JSON.parse (<anonymous>)
at updateCmds (/usr/lib/triggercmdagent/resources/app/src/agent.js:429:24)
at Timeout._onTimeout (/usr/lib/triggercmdagent/resources/app/src/agent.js:710:9)
at ontimeout (timers.js:436:11)
at tryOnTimeout (timers.js:300:5)
at listOnTimeout (timers.js:263:5)
at Timer.processTimers (timers.js:223:10)
Restoring the last known good file
Restore backup completed.It looks like you have some invalid json in the command.json you're trying to save, so the agent is restoring the last good commands.json it had. Can you post your commands.json here so I can maybe spot the problem?
Another thing you could try is paste it into a json formatter online, like this one:
https://jsonformatter.curiousconcept.com/ -
@Russ said in TriggerCMD on Ubuntu Server 20.04 background service:
@julianbr said in TriggerCMD on Ubuntu Server 20.04 background service:
SyntaxError: Unexpected token { in JSON at position 461
It looks like you have some invalid json in the command.json you're trying to save, so the agent is restoring the last good commands.json it had. Can you post your commands.json here so I can maybe spot the problem?
Another thing you could try is paste it into a json formatter online, like this one:
https://jsonformatter.curiousconcept.com/Ahh, missed that! Thanks! I failed to add , at the end of the line.. I also got the daemon installed now. Default is /root so I change the line to make it run under my user:
node /usr/lib/triggercmdagent/resources/app/src/daemon.js --run /home/YOURDIRECTORY/.TRIGGERcmdData/
-
@julianbr, nice job. I'm glad you got it figured out.