• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
TRIGGERcmd
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login

Ubuntu Linux agent instructions

Linux
6
21
9.1k
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R
    Russ
    last edited by Russ Apr 9, 2025, 11:34 PM Apr 3, 2017, 11:06 PM

    On Ubuntu (and Mint and other Debian based Linux distros), you should install the agent like this:

    Do this while logged in as your user (not root), in a Terminal window:

    sudo apt-get -y update
    sudo apt-get -y upgrade
    wget https://s3.amazonaws.com/triggercmdagents/triggercmdagent_1.0.1_amd64.deb
    sudo apt install ./triggercmdagent_1.0.1_amd64.deb
    

    If you're in X-Windows, type:

    sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
    triggercmdagent   
    

    If you're not in X-Windows, make sure you have nodejs 16+ installed, then run one of these 2 commands instead (depending on your specific OS):

    node /usr/share/triggercmdagent/resources/app/src/agent.js --console
    node /usr/lib/triggercmdagent/resources/app/src/agent.js --console  (newer Ubuntu OS's)
    

    Log into your triggercmd.com account, and copy the token from the Instructions link, and paste it into the Token prompt.

    Then to install the background service:
    If you're in X-Windows: Right-click T tray icon, click Background Service - Install Background Service
    If you're not in X-Windows, CTRL-C out of the above "agent.js --console" command, and run:

    sudo sh /usr/share/triggercmdagent/resources/app/src/installdaemon.sh
    sudo sh /usr/lib/triggercmdagent/resources/app/src/installdaemon.sh  (newer Ubuntu OS's)
    

    To check the status of the background service:

    • Run: systemctl status triggercmdagent
    • In your triggercmd.com account, click View Triggers. If you see your background triggers, the background service is working.

    If at first the background service doesn't install, try this:

    • CTRL-C, or select Quit from the T tray icon.
    • Re-run triggercmdagent
    • Try installing it again using the tray icon.

    To upgrade see Upgrading the Linux agent on Ubuntu

    EDIT 6/4/18: For Ubuntu 14 you'll have to install using this method instead:

    sudo su -
    wget https://s3.amazonaws.com/triggercmdagents/triggercmdagent_1.0.1_amd64.deb
    dpkg -i ./triggercmdagent_1.0.1_amd64.deb
    apt-get install -f
    exit
    triggercmdagent
    

    Russell VanderMey

    P 1 Reply Last reply Oct 6, 2020, 12:56 AM Reply Quote 0
    • Z
      zsmarthome
      last edited by Jun 16, 2020, 10:41 AM

      Working without problems on Centos 8 minimal installation.

      1 Reply Last reply Reply Quote 1
      • P
        pirates @Russ
        last edited by Oct 6, 2020, 12:56 AM

        @Russ Not working for me. I did all your steps, but I am getting this on final check:

        alt text

        https://imgur.com/QHDUV8q.

        And it was server when I installed base system for VM, but after all this command, it turn to GUI and can't open terminal anymore.

        R 1 Reply Last reply Oct 6, 2020, 12:06 PM Reply Quote 0
        • R
          Russ @pirates
          last edited by Russ Oct 6, 2020, 12:07 PM Oct 6, 2020, 12:06 PM

          @pirates, please try this. Switch to root with this command:

          sudo su -
          

          Run this:

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

          It should prompt for your token, then start running. If it does, CTRL-C, then restart your triggercmdagent daemon with this command:

          systemctl restart triggercmdagent
          

          You can also watch the full log for the agent in another window with:

          journalctl -u triggercmdagent -n 100 -f
          

          Please send me any errors you see.

          Russell VanderMey

          P 1 Reply Last reply Oct 9, 2020, 2:53 AM Reply Quote 0
          • P
            pirates @Russ
            last edited by Oct 9, 2020, 2:53 AM

            @Russ I will try but why is it switching to GUI version of my install from headless I had initially?

            R 1 Reply Last reply Oct 9, 2020, 12:03 PM Reply Quote 0
            • R
              Russ @pirates
              last edited by Oct 9, 2020, 12:03 PM

              @pirates, are you saying you installed Linux without the X-Windows GUI, then when you installed the TRIGGERcmd agent it installed X-Windows with it?

              If that's the case, I'd like to try to reproduce that. What Linux are you using?

              Russell VanderMey

              P 1 Reply Last reply Oct 10, 2020, 3:51 AM Reply Quote 0
              • P
                pirates @Russ
                last edited by Oct 10, 2020, 3:51 AM

                @Russ I am using ubuntu server 20.4 on proxmox vm to test. And yes from server to x-windows.. tried twice and happened both time.

                R 1 Reply Last reply Oct 10, 2020, 2:47 PM Reply Quote 0
                • R
                  Russ @pirates
                  last edited by Russ Oct 23, 2020, 10:18 PM Oct 10, 2020, 2:47 PM

                  Thanks @pirates. I'll try to reproduce and see if I can fix that. I suspect the agent depends on a package that depends on X-Windows, so it automatically installed X-Windows.

                  In the meantime, you could disable X-Windows at boot.

                  EDIT: @pirates, I reproduced the issue. I had a non-GUI, no X-Windows Ubuntu 20 VM, then installed the agent and it installed X-Windows. I'll get back to you soon because there should be a way to run the agent as a background service without X-Windows, like you can on a Raspberry Pi.

                  EDIT2: @pirates, this procedure worked for me to install the background agent without X-Windows:

                  sudo su -
                  git clone https://github.com/rvmey/TRIGGERcmd-Agent.git
                  cp ubuntupackage.json package.json
                  apt install -y npm
                  cd /root/TRIGGERcmd-Agent
                  npm install
                  node /root/TRIGGERcmd-Agent/src/agent.js --console
                    (enter your token, then press CTRL-C to exit the foreground agent)
                  /bin/sh /root/TRIGGERcmd-Agent/src/daemonmgr.sh --add /root/.TRIGGERcmdData
                  systemctl enable triggercmdagent
                  systemctl status triggercmdagent
                  

                  I copied these instructions to a new article here.

                  Russell VanderMey

                  1 Reply Last reply Reply Quote 0
                  • P
                    pirates
                    last edited by Oct 15, 2020, 4:18 AM

                    I will try as soon as I get some free time and I will get back to you. Thanks for reply.

                    1 Reply Last reply Reply Quote 0
                    • P
                      pirates
                      last edited by Oct 23, 2020, 9:33 PM

                      Is this normal?

                      root@fox:~/TRIGGERcmd-Agent# npm install
                      npm WARN deprecated chokidar@1.7.0: Chokidar 2 will break on node v14+. Upgrade                                   to chokidar 3 with 15x less dependencies.
                      npm WARN deprecated request@2.88.2: request has been deprecated, see https://git                                  hub.com/request/request/issues/3142
                      npm WARN deprecated posix-argv-parser@2.0.0: No longer maintained
                      npm WARN deprecated gulp-util@2.2.20: gulp-util is deprecated - replace it, foll                                  owing the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
                      npm WARN deprecated gulp-util@3.0.8: gulp-util is deprecated - replace it, follo                                  wing the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
                      npm WARN deprecated react-tools@0.13.3: react-tools is deprecated. For more info                                  rmation, visit https://fb.me/react-tools-deprecated
                      npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and coul                                  d be using insecure binaries. Upgrade to fsevents 2.
                      npm WARN deprecated har-validator@5.1.5: this library is no longer supported
                      npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade                                   to chokidar 3 with 15x less dependencies.
                      npm WARN deprecated core-js@1.2.7: core-js@<3 is no longer maintained and not re                                  commended for usage due to the number of issues. Please, upgrade your dependenci                                  es to the actual version of core-js@3.
                      npm WARN deprecated buffer@2.1.13: This version of 'buffer' is out-of-date. You                                   must update to v2.8.3 or newer
                      npm WARN deprecated circular-json@0.3.3: CircularJSON is in maintenance only, fl                                  atted is its successor.
                      npm WARN deprecated core-js@2.6.11: core-js@<3 is no longer maintained and not r                                  ecommended for usage due to the number of issues. Please, upgrade your dependenc                                  ies to the actual version of core-js@3.
                      npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprec                                  ated
                      npm WARN deprecated minimatch@0.3.0: Please update to minimatch 3.0.2 or higher                                   to avoid a RegExp DoS issue
                      npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#dep                                  recated
                      npm ERR! code EBADPLATFORM
                      npm ERR! notsup Unsupported platform for node-windows@0.1.14: wanted {"os":"win3                                  2","arch":"any"} (current: {"os":"linux","arch":"x64"})
                      npm ERR! notsup Valid OS:    win32
                      npm ERR! notsup Valid Arch:  any
                      npm ERR! notsup Actual OS:   linux
                      npm ERR! notsup Actual Arch: x64
                      
                      npm ERR! A complete log of this run can be found in:
                      npm ERR!     /root/.npm/_logs/2020-10-23T21_32_13_991Z-debug.log
                      root@fox:~/TRIGGERcmd-Agent#
                      
                      
                      R 1 Reply Last reply Oct 23, 2020, 10:17 PM Reply Quote 0
                      • R
                        Russ @pirates
                        last edited by Russ Oct 23, 2020, 10:19 PM Oct 23, 2020, 10:17 PM

                        @pirates, to avoid that problem, copy the ubuntupackage.json file to package.json before you run npm install. I'll update the steps above with that. It looks like the default package.json was the Windows version.

                        Russell VanderMey

                        ? 1 Reply Last reply Nov 19, 2020, 11:59 PM Reply Quote 0
                        • ?
                          A Former User @Russ
                          last edited by Nov 19, 2020, 11:59 PM

                          @Russ I have this installed and functional on a Debian 10 Raspberry Pi. The default commands work great, as well as a custom one that triggers a bash script that sends a WOL command to my PC.

                          Question for you: Does triggercmd run the script as root, or as the user with elevated privileges via sudo?

                          R 1 Reply Last reply Nov 20, 2020, 1:01 AM Reply Quote 0
                          • R
                            Russ @A Former User
                            last edited by Nov 20, 2020, 1:01 AM

                            @Tim-Manochehri, it runs them as root. If you run this command you'll see that the agent runs as root, and the agent runs the commands:

                            ps -ef | grep triggercmdagent
                            

                            Russell VanderMey

                            1 Reply Last reply Reply Quote 0
                            • Daniel MachínD
                              Daniel Machín
                              last edited by Jan 25, 2021, 12:09 PM

                              Hi,

                              I have followed the instructions in a headless Ubuntu, getting some errors:

                              dpkg: error al procesar el paquete triggercmdagent (--install):
                              installed triggercmdagent package post-installation script subprocess returned error exit status 127

                              Triggercmd is installed but now, every time I try to apt upgrade it tries to reinstall triggercmd...

                              Is this the normal behaviour?

                              R 1 Reply Last reply Jan 25, 2021, 11:48 PM Reply Quote 0
                              • R
                                Russ @Daniel Machín
                                last edited by Russ Jan 25, 2021, 11:48 PM Jan 25, 2021, 11:48 PM

                                @Daniel-Machín, that's not normal. I'd like to try to reproduce that problem and fix it. Can you tell me the commands you ran, and which specific operating system you installed it on? You wrote "headless" so I understand you did not install X-Windows on it.

                                Russell VanderMey

                                1 Reply Last reply Reply Quote 0
                                • Daniel MachínD
                                  Daniel Machín
                                  last edited by Daniel Machín Jan 26, 2021, 11:22 PM Jan 26, 2021, 11:16 PM

                                  Hi Russ,

                                  Thanks for your reply!

                                  System is an Ubuntu 18.04.5 LTS (bionic) without X-Windows

                                  Anyway, I finally managed to make it work. Issue was dependencies:

                                  apt install npm
                                  

                                  solved the problem

                                  Perhaps, including npm as a dependency within .deb package could solve potential future issues (currently, only nodejs is a dependency):

                                  daniel@servidor:~$ sudo apt-cache depends triggercmdagent
                                  triggercmdagent
                                    Depende: nodejs
                                  

                                  Thanks!
                                  Daniel

                                  R 1 Reply Last reply Jan 26, 2021, 11:31 PM Reply Quote 0
                                  • R
                                    Russ @Daniel Machín
                                    last edited by Jan 26, 2021, 11:31 PM

                                    Thanks @Daniel-Machín. Good call. I'll add that.

                                    https://github.com/rvmey/TRIGGERcmd-Agent/blob/master/ubuntupackage.json#L52

                                    Russell VanderMey

                                    P 1 Reply Last reply Mar 3, 2021, 6:32 PM Reply Quote 0
                                    • P
                                      Pr0k0 @Russ
                                      last edited by Mar 3, 2021, 6:32 PM

                                      @Russ One question does the agent automatically open in Linux at startup like windows? Because every time I boot I need to open it manually and it does not start up automatically. I followed the installation steps above, uninstalled, installed again but the same problem.... in windows and raspberry it is working fine with no issues... Do i need to install with no UI in Linux like raspberry??

                                      R 1 Reply Last reply Mar 3, 2021, 11:51 PM Reply Quote 0
                                      • R
                                        Russ @Pr0k0
                                        last edited by Russ Mar 3, 2021, 11:51 PM Mar 3, 2021, 11:51 PM

                                        @Pr0k0, the foreground Linux agents do not run automatically in X-Windows. I researched it but couldn't find a standard way to do that. If you install the background service, that will start during boot, but you'll need to make set the "ground" field in your commands.json file to "background" instead of "foreground" because the background agent adds/removes/runs background commands.

                                        Russell VanderMey

                                        P 1 Reply Last reply Mar 4, 2021, 7:46 AM Reply Quote 0
                                        • P
                                          Pr0k0 @Russ
                                          last edited by Mar 4, 2021, 7:46 AM

                                          @Russ thnx for the reply, i understand, i tried to make a .sh file to execute the application in a cronjob when boot but it does not start......i cannot understand why, if execute manually the sh file starts normally, i also tried to create a service with some name pointing to the file.....service is active but again in boot, it does not start... the problem is because in the foreground i can make routines and not need to say the computer name everytime....that's why the foreground is helpful...the background service is not visible in the Home Skills so i cannot make a routine. Anyway thanks again for the reply.

                                          R 1 Reply Last reply Mar 4, 2021, 11:50 PM Reply Quote 0
                                          • First post
                                            Last post