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
-
@Russ Hi, first I would like to thank you for all support!
I'm trying to load Triggercmd right after boot on Linux Mint 21.3 Cinnamon.
Here is my current setup:
Triggercmd is already working with Alexa with only one trigger configured ( to shutdown my machine) but for it to work, then I first need to put my PC credentials and wait for desktop to load, then command works...I was wondering if it is possible to load Triggercmd right after boot so I don't have to login on linux mint for commands to work...
FYI - I have triggercmdagent.service active (running) and already installed Background service (via Install background service option) on linux mint tray
thanks!!
-
@Brunera-EL, one of the advantages of the background service is it runs before you login. It also runs background commands as root on Linux.
If you create a background command, does it show up on the website? If so, that means the background service is working. Please try changing the ground setting on your shutdown command to background, and try running it before you login. It should work.
-
@Russ Hi Russ! I have created new commands for testing purposes but only the ones that are marked as "foreground" were showing up on the website... So I used the option "remove background services" and then "install background services" and right after that the background commands appeared on website.... Not sure what happened, maybe something was stuck and cleared by itself after the reinstall...anyway, it's working properly now!! Thank you for all quick support, really appreciate that!
Best regards