Ubuntu Linux agent instructions



  • @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.



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



  • @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?



  • @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.



  • 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.



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



  • 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#
    
    


  • @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.



  • @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?



  • @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

Log in to reply