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

    Install from github repo?

    General Discussion
    2
    23
    5.3k
    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.
    • RussR
      Russ @stevef9432203
      last edited by

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

      Russell VanderMey

      1 Reply Last reply Reply Quote 0
      • S
        stevef9432203
        last edited by Russ

        @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: tokenblahblahremoved
        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

        RussR 1 Reply Last reply Reply Quote 0
        • RussR
          Russ @stevef9432203
          last edited by

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

          Russell VanderMey

          1 Reply Last reply Reply Quote 0
          • S
            stevef9432203
            last edited by

            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

            RussR 1 Reply Last reply Reply Quote 0
            • RussR
              Russ @stevef9432203
              last edited by Russ

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

              Russell VanderMey

              1 Reply Last reply Reply Quote 0
              • S
                stevef9432203
                last edited by

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

                1 Reply Last reply Reply Quote 0
                • S
                  stevef9432203
                  last edited by

                  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

                  RussR 1 Reply Last reply Reply Quote 0
                  • RussR
                    Russ @stevef9432203
                    last edited by Russ

                    @stevef9432203, so are you good now?

                    Russell VanderMey

                    1 Reply Last reply Reply Quote 0
                    • S
                      stevef9432203
                      last edited by

                      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

                      RussR 1 Reply Last reply Reply Quote 0
                      • RussR
                        Russ @stevef9432203
                        last edited by

                        @stevef9432203, yes please!

                        Russell VanderMey

                        1 Reply Last reply Reply Quote 0
                        • S
                          stevef9432203
                          last edited by Russ

                          @stevef9432203 said in Install from github repo?:

                          node ./src/agent.js --console

                          =Current Installl notes-

                          Entware What is it -

                          Minimum Requirements - Extra storage (Small HD preferred,but will work with USB stick)
                          Also Router should have 128M or ram. The TriggerCMD will use about 25M of ram.

                          Entware - Is an addon for Embedded devices "Routers, Access Points, and Nas"
                          that with install of Entware Repo adds an addtional 2200 additional apps to what
                          is in your Router or Nas.

                          ---->>>> https://entware.net/about.html

                          See https://github.com/Entware/Entware/wiki for supported devices 
                          and Installion notes.
                          
                          Perform steps from wiki to install on your Device.
                          

                          Once Entware is installed you need to perform these Steps

                          ######################## INSTALL node-js and utils #################################

                          opkg update

                          Downloading http://bin.entware.net/mipselsf-k3.4/Packages.gz.
                          Updated list of available packages in /opt/var/opkg-lists/entware.

                          opkg upgrade

                          Downloading and updating installed Packages...

                          opkg install node-js

                          Installing node-js...

                          opkg install node-npm

                          Install node-npm.....

                          opkg install git-http

                          Installing git-http tools...

                          update npm

                          npm update npm

                          ths took 4 minutes now have patience...

                          ###################################################################################

                          ############################# Install TriggerCMD-Agent ############################
                          cd /mnt

                          Get Mount point

                          mount

                          ubi:rootfs_ubifs on / type ubifs (ro,relatime)
                          devtmpfs on /dev type devtmpfs (rw,relatime,mode=0755)
                          proc on /proc type proc (rw,relatime)
                          tmpfs on /var type tmpfs (rw,noexec,relatime,size=420k)
                          sysfs on /sys type sysfs (rw,relatime)
                          debugfs on /sys/kernel/debug type debugfs (rw,relatime)
                          mtd:bootfs on /bootfs type jffs2 (ro,relatime)
                          devpts on /dev/pts type devpts (rw,relatime,mode=600)
                          mtd:data on /data type jffs2 (rw,relatime)
                          tmpfs on /tmp type tmpfs (rw,relatime)
                          /dev/mtdblock8 on /jffs type jffs2 (rw,noatime)
                          /dev/sda1 on /tmp/mnt/Backup+Hub type ext4 (rw,nodev,relatime,stripe=8191,data=ordered)

                          Your mount point is usually dev/sda1

                          on my router /dev/sda1 on {/tmp/mnt/Backup+Hub}

                          Now we need to change to the directory returned by you mount command ( not Mine)

                          cd /tmp/mnt/Backup+Hub

                          Now lets make a "gitrepo" directory

                          mkdir gitrepo

                          Now change to that directory

                          cd gitrepo

                          Now lets clone the from Github. -# https://github.com/rvmey/TRIGGERcmd-Agent.git #-

                          git clone https://github.com/rvmey/TRIGGERcmd-Agent.git
                          Cloning into 'TRIGGERcmd-Agent'...
                          remote: Enumerating objects: 65, done.
                          remote: Counting objects: 100% (65/65), done.
                          remote: Compressing objects: 100% (44/44), done.
                          remote: Total 809 (delta 35), reused 44 (delta 21), pack-reused 744
                          Receiving objects: 100% (809/809), 17.73 MiB | 11.22 MiB/s, done.
                          Resolving deltas: 100% (371/371), done.

                          Now install Agent dependencies

                          cd to TriggerCMD agent

                          cd TRIGGERcmd-Agent

                          Now udate dependcy files

                          npm install
                          npm WARN deprecated coffee-script@1.12.7: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
                          npm WARN deprecated istanbul@0.4.5: This module is no longer maintained, try this instead:
                          npm WARN deprecated npm i nyc
                          npm WARN deprecated Visit https://istanbul.js.org/integrations for other alternatives.
                          npm WARN deprecated jade@1.11.0: Jade has been renamed to pug, please install the latest version of pug instead of jade
                          npm WARN deprecated gulp-util@3.0.8: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
                          npm WARN deprecated gulp-util@2.2.20: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
                          npm WARN deprecated react-tools@0.13.3: react-tools is deprecated. For more information, visit https://fb.me/react-tools-deprecated
                          npm WARN deprecated constantinople@3.0.2: Please update to at least constantinople 3.1.1
                          npm WARN deprecated transformers@2.1.0: Deprecated, use jstransformer
                          npm WARN deprecated graceful-fs@3.0.11: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
                          npm WARN deprecated circular-json@0.3.3: CircularJSON is in maintenance only, flatted is its successor.
                          npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
                          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 browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
                          npm WARN deprecated hoek@2.16.3: This version is no longer maintained. Please upgrade to the latest version.
                          npm WARN deprecated boom@2.10.1: This version is no longer maintained. Please upgrade to the latest version.
                          npm WARN deprecated cryptiles@2.0.5: This version is no longer maintained. Please upgrade to the latest version.
                          npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
                          npm WARN deprecated graceful-fs@1.2.3: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js

                          electron@4.0.0 postinstall /tmp/mnt/Backup+Hub/gitrepo/TRIGGERcmd-Agent/node_modules/electron-prebuilt-compile/node_modules/electron
                          node install.js
                          npm notice created a lockfile as package-lock.json. You should commit this file.
                          npm WARN triggercmdagent@1.0.1 No repository field.
                          npm WARN triggercmdagent@1.0.1 license should be a valid SPDX license expression
                          npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.7 (node_modules/fsevents):
                          npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"arm64"})

                          Just ignore the WARN messages, it will run

                          added 1407 packages from 901 contributors, updated 1 package and audited 14059 packages in 164.529s

                          ################################## Install the 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: c5NiIsImlhasdf1MDM3NTcyN30.hcOtGZ7U95kS1nhCi4P1asdfobug-Pn4LAFJSY
                          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 5c68db4062f9b30017477972 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: Sat Feb 16 2019 19:55:45 GMT-0800 (PST)

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

                          If you got these steps you are Alive!!! Control C to Stop

                          #########################################################

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

                          Startup Test of running as root ->>>

                          /tmp/mnt/Backup+Hub/gitrepo/TRIGGERcmd-Agent# /opt/bin/node ./src/daemon.js --run /root/.TRIGGERcmdData
                          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

                          lets Create Entware Startup Script -

                          RussR 1 Reply Last reply Reply Quote 0
                          • RussR
                            Russ @stevef9432203
                            last edited by

                            @stevef9432203, thank you for posting your steps!

                            Russell VanderMey

                            1 Reply Last reply Reply Quote 0
                            • S
                              stevef9432203
                              last edited by

                              I've put a more complete install outline, in the Installs Sub-Forum. Let me know if its complete enough.

                              RussR 1 Reply Last reply Reply Quote 0
                              • RussR
                                Russ @stevef9432203
                                last edited by

                                @stevef9432203, yes, I think that's good. Thank you for doing it. I don't have a router to verify every step, but the instructions look detailed enough that someone could follow it.

                                Russell VanderMey

                                1 Reply Last reply Reply Quote 0
                                • S
                                  stevef9432203
                                  last edited by

                                  Tested on Two asus Routers asus rt ac5300, asus gt-ac5300, and qnap nas

                                  RussR 1 Reply Last reply Reply Quote 0
                                  • RussR
                                    Russ @stevef9432203
                                    last edited by

                                    @stevef9432203, ooh, I do have a qnap nas I could try it on.

                                    Russell VanderMey

                                    1 Reply Last reply Reply Quote 0
                                    • S
                                      stevef9432203
                                      last edited by

                                      Interesting issue pops up every few boots, two files dissapear; token.tkn and computerid
                                      .cfg vanish after reboot. Kind of resembles lack flexible closure or no shutdown handling traps hup
                                      Oct or kill..Gotta restore token.tkn to reboot sevices .

                                      Comments? Or ?

                                      ..

                                      RussR 1 Reply Last reply Reply Quote 0
                                      • RussR
                                        Russ @stevef9432203
                                        last edited by

                                        @stevef9432203, please confirm - your commands.json stays when the router reboots, but your token.tkn file and computerid.cfg file go away? If so that's odd because the agent doesn't keep those two files open - it just reads them during startup.

                                        Russell VanderMey

                                        1 Reply Last reply Reply Quote 0
                                        • S
                                          stevef9432203
                                          last edited by

                                          Yes the commands.json files stay intact. I will move content startup directory to hard disk storage to test. Can I specify the path to the data directory with the '--run' path prefix ?

                                          RussR 1 Reply Last reply Reply Quote 0
                                          • RussR
                                            Russ @stevef9432203
                                            last edited by

                                            @stevef9432203, no, but you could change this line to set your "homedir" to something else.

                                            homedir = (process.platform === 'win32') ? process.env.HOMEPATH : process.env.HOME;
                                            

                                            Or maybe you could symlink your ~/.TRIGGERcmdData folder to a path on your hard drive.

                                            Russell VanderMey

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post