How do you load Triggercmd on boot on Ubuntu?
-
Any way I can automagically load the triggercmd on boot on Ubuntu?
Just /usr/lib/triggercmdagent/triggercmdagent in Startup Applications or are there an parameters needed?
Thanks,
sid. -
@Sid-Boswell, no parameters are needed to run the agent in foreground mode. It will find what it needs in your ~/.TRIGGERcmdData directory.
You can install the agent to startup in background mode during boot by running the installdaemon.sh script with sudo.
Please look at this page for more details.
-
-
@Russ
Hey,I'm using ubuntu container on QNAP when running the .sh it says the following:
avishai@ubuntu:~$ sudo /usr/share/triggercmdagent/app/src/installdaemon.sh
node[680]: pthread_create: Invalid argument
Daemon install: true
Logging in with saved token.
Checking if the 64dd4da843f3df001afa9817 computer exists.
This computer exists in your account.
System has not been booted with systemd as init system (PID 1). Can't operate.
System has not been booted with systemd as init system (PID 1). Can't operate.
Configuration file /etc/systemd/system/triggercmdagent.service is marked executable. Please remove executable permission bits. Proceeding anyway.
Created symlink /etc/systemd/system/default.target.wants/triggercmdagent.service → /etc/systemd/system/triggercmdagent.service.
System has not been booted with systemd as init system (PID 1). Can't operate. -
@Avishai-Algrisi, thanks for showing me this. I see a bug. I'll update it soon.
EDIT: Actually, I wasn't able to reproduce your error, but I think you're installing the backgroud agent but you probably don't need to.
You can run the agent like this:
node /usr/share/triggercmdagent/app/src/agent.js --console
You could also try this image witht the agent built in:
https://hub.docker.com/r/rvmey/triggercmdagent -
@Russ
Hey Russ,Thank you for replying.
The docker container works, forgot to mention I'm with arm processor.one more thing please if you can, I had this problem in the past but I don't remember what I did that it worked.
After adding the token, the container register in the website successfully but it shows only "Gnome Editor" while my "/root/.TRIGGERcmdData/commands.json" looks like this:
# find / -iname commands.json /root/.TRIGGERcmdData/commands.json # cat /root/.TRIGGERcmdData/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"}, {"trigger":"startpc","command":"etherwake -i eth0 B4:2E:99:A1:DF:CB","ground":"background","voice":"startpc","allowParams":"false"} ] #
All I care here of course is the last one
-
@Avishai-Algrisi, good question. You're running the agent in foreground mode, which is fine, but it's ignoring all of the commands on your commands.json with "ground":"background". That's why you only see the Gnome Editor command - it's a foreground command. Change the ground setting on your startpc command to foreground, and it should work.
-
@Russ I love you. ️
-
Thanks @Avishai-Algrisi