Install from github repo?



  • Any way to install triggercmd from the github repo. I want the agent installed on my asus router so that I can do wakeonlan, which is supported. Got node-js & node-npm installed from entware repo. Two things needed for this will be to change the base path to /opt/ as this is used as the / path is in rom.


  • administrators

    @stevef9432203, yes, you should be able to download the Github repo: https://github.com/rvmey

    Then run this command:

    node ./src/agent.js --console


  • @russ said in Install from github repo?:

    node ./src/agent.js --console

    Since I am Clueless
    stever@GT-AC5300:/tmp/mnt/Backup+Hub/gitrepo/TRIGGERcmd-Agent# node ./src/agent.
    js --console

    module.js:550
    throw err;
    ^

    Error: Cannot find module 'socket.io-client'
    at Function.Module._resolveFilename (module.js:548:15)
    at Function.Module._load (module.js:475:25)
    at Module.require (module.js:597:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/tmp/mnt/Backup+Hub/gitrepo/TRIGGERcmd-Agent/src/agent.js:43:22)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)


  • administrators

    @stevef9432203, I forgot you need to run this from the root of the git repo:

    npm install
    

    You'll probably need to install npm first.



  • @russ said in Install from github repo?:

    node ./src/agent.js --console

    Seems to load
    stever@GT-AC5300:/tmp/mnt/Backup+Hub/gitrepo/TRIGGERcmd-Agent# node ./src/agent.js --console
    Run installdaemon.sh to install the triggercmdagent daemon so it runs during boot
    Daemon install: false
    No token exists. Login to request one.
    prompt: token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVjNTM4YTY5YmE1ZWQ5MDAxYWU2Mjc5NiIsImlhdCI6MTU0OTUxMDA3OH0.eskzSF-VW0E-B82ke8gUw--VzmfwEO6_qr_09TGEPSQ
    Token saved for next time.
    Tokenfile: /root/.TRIGGERcmdData/token.tkn
    ComputerIDfile: /root/.TRIGGERcmdData/computerid.cfg
    Logging in with saved token to run foreground tasks.
    Computer ID 5c5ba652592b050016ee1e4a saved for next time.
    Write backup completed.
    Initiated command removals

    |> 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: Wed Feb 06 2019 19:30:27 GMT-0800 (PST)

    Initiated command adds
    { message: 'Subscribed to 5c5ba652592b050016ee1e4a!' }
    { message: 'Subscribed to 5c5ba652592b050016ee1e4a!' }
    Added Gnome Editor

    I will have to create a startup s cript and when down I will use these instructions to create an install instruction
    set


  • administrators

    @stevef9432203, that's awesome! I never thought I'd see the agent running on a router.



  • asus gt-ac5300 4 cores and 1gb ram 256mb flash, two usb 3 ports, got 6tb drive plugged in.

    Any way to get list commands


  • administrators

    @stevef9432203, you probably know you can get the list of commands for the local computer from ~/.TRIGGERcmdData/commands.json, but are you asking if there's an API endpoint to list the commands?

    Please explain more specifically what you're looking for. I'm willing to add an API if it would help.

    For now, you could try these:

    curl -X GET https://www.triggercmd.com/api/computer/list -H "authorization: Bearer `cat ~/.TRIGGERcmdData/token.tkn`" | jq
    
    curl -X POST https://www.triggercmd.com/api/command/list -H "authorization: Bearer `cat ~/.TRIGGERcmdData/token.tkn`" -H 'content-type: application/json' -d  '{"computer_id":"5ab7db9d8d2282785d369132"}' | jq
    
    curl -X GET https://www.triggercmd.com/api/command/commandlist -H "authorization: Bearer `cat ~/.TRIGGERcmdData/token.tkn`" -H 'content-type: application/json'  | jq
    

    The first one lists your computers.
    The second one lists the commands for a given computer.
    The third lists all of your commands on all of your computers with a field called "did" showing (computer_id)-(command_id).



  • Specifically triggercmd start up options. I am assuming options for starting as system start,syslog options , daemon, etc



  • Well so far I've emulated the linux install script option and got thus far -

    Startup cmd from my Linux workstation systemd service file
    node /usr/share/triggercmdagent/resources/app/src/daemon.js --run /home/stevef/.TR

    Startup Test of running as root ->>>

    /tmp/mnt/Backup+Hub/gitrepo/TRIGGERcmd-Agent# node ./src/daemon.js --run /root/.TR
    Running Linux daemon to run background tasks.
    Run installdaemon.sh to install the triggercmdagent daemon so it runs during boot
    Tokenfile: /root/.TRIGGERcmdData/token.tkn
    ComputerIDfile: /root/.TRIGGERcmdData/computerid.cfg
    Logging in with saved token to run background tasks.
    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: Sun Feb 10 2019 12:59:47 GMT-0800 (PST)

    { message: 'Subscribed to 5c608a9f592b050016ee2fff!' }
    Initiated command removals
    { message: 'Subscribed to 5c608a9f592b050016ee2fff!' }
    Initiated command adds
    Added Reboot
    Added yum update
    Added apt update

    Damn it works

    ps | grep node
    13393 stever 3076 R grep node
    27544 stever 1098m S node ./src/daemon.js --run /root/.TRIGGERcmdData


  • administrators

    @stevef9432203, so are you good now?



  • seems so, just got to create a entware start script in /opt/etc/init.d to start it.
    Would you like a full install howto? This can be used with a lot of routers that support Entware


  • administrators

    @stevef9432203, yes please!


Log in to reply
 

Looks like your connection to TRIGGERcmd Forum was lost, please wait while we try to reconnect.