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

    background service linux

    General Discussion
    2
    6
    583
    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.
    • frederico allanF
      frederico allan
      last edited by

      after install background service and close triggercmd agent, my alexia commands dont work.

      look my agent status:

      fred@NOTEBOOK:~$systemctl status triggercmdagent.service 
      ā— triggercmdagent.service - TRIGGERcmd Agent
         Loaded: loaded (/etc/systemd/system/triggercmdagent.service; enabled; vendor preset: enabled)
         Active: failed (Result: start-limit-hit) since Tue 2020-06-02 14:02:24 -03; 14min ago
        Process: 29520 ExecStart=/usr/bin/env node /usr/lib/triggercmdagent/resources/app/src/daemon.js --run /root/.TRIGGERcmdData (code=exited, status=0/SUCCESS)
       Main PID: 29520 (code=exited, status=0/SUCCESS)
            CPU: 282ms
      

      Just woks with open agent or run this command:

      fred@NOTEBOOK:~$node /usr/lib/triggercmdagent/resources/app/src/daemon.js --run /home/fred/.TRIGGERcmdData
      Running Linux daemon to run background tasks.
      Run installdaemon.sh to install the triggercmdagent daemon so it runs during boot
      Tokenfile: /home/fred/.TRIGGERcmdData/token.tkn
      ComputerIDfile: /home/fred/.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: Tue Apr 23 2019 18:29:36 GMT+0000 (UTC)
      
      
      
      Initiated command adds
      Initiated command removals
      { message: 'Subscribed to 5ace777f053a4600193464d1!' }
      { message: 'Subscribed to 5ace777f053a4600193464d1!' }
      { trigger: 'open-youtube', id: '5ace9eb5a2b3bd0019322655' }
      Running trigger: open-youtube  Command: google-chrome https://www.youtube.com;
      Reported: Command Ran
      
      RussR 1 Reply Last reply Reply Quote 0
      • RussR
        Russ @frederico allan
        last edited by Russ

        @frederico-allan, the background agent adds, removes, and runs background commands only, and the foreground agent adds/removes/runs foregound commands.

        Also background commands run as root in the background (no GUI) using the /root/.TRIGGERcmdData folder which is associated with a different computer object in your account if you ran the foregound agent as your non-root user originally.

        If you compare these two files, you'll probably see different computer ID's:

        /home/fred/.TRIGGERcmdData/computerid.cfg
        /root/.TRIGGERcmdData/computerid.cfg
        

        Russell VanderMey

        frederico allanF 1 Reply Last reply Reply Quote 0
        • frederico allanF
          frederico allan @Russ
          last edited by frederico allan

          @Russ tks for your attention.

          One Question: /root/.TRIGGERcmdData/computerid.cfg doesn't exists.

          root@NOTEBOOK:~/.TRIGGERcmdData# cat 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"}
          ]
          root@NOTEBOOK:~/.TRIGGERcmdData# cat debug.log 
          No token exists.  Login to request one.
          Quitting
          root@NOTEBOOK:~/.TRIGGERcmdData# ls -al
          total 24
          drwxr-xr-x  2 root root 4096 mai 20 12:52 .
          drwx------ 20 root root 4096 mai 27 14:03 ..
          -rw-r--r--  1 root root  461 mai 15 09:53 commands.json
          -rw-r--r--  1 root root   49 mai 26 10:38 debug.log
          -rw-r--r--  1 root root  516 mai 15 09:53 sendresult.sh
          -rw-r--r--  1 root root  228 jun  2 14:02 triggercmdagent.service
          
          

          But exists in this folder ~/.TRIGGERcmdData/computerid.cfg.

          [
           {
            "trigger": "open-youtube",
            "command": "google-chrome https://www.youtube.com;",
            "ground": "background",
            "voice": "abrir youtube",
            "voiceReply": "open youtube",
            "allowParams": "false"
           },
          .
          .
          .
          

          does any thing wrong with my instalattion?

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

            @frederico-allan, if you run triggercmdagent while logged in as root, it should create a /root/.TRIGGERcmdData/computerid.cfg file, and background service should use that. Just run triggercmdagent, then CTRL-C to exit.

            Also, it doesn't make sense to run google-chrome as a background command because you won't be able to see it.
            You want to run google chrome in the foreground agent. You run the foreground agent by running triggercmdagent in a terminal window in Xwindows.

            Russell VanderMey

            1 Reply Last reply Reply Quote 0
            • frederico allanF
              frederico allan
              last edited by frederico allan

              @Russ i got it now. tks a lot!

              in fact, I need start triggercmdagent on startup. thats the point of this thread, cause I thought that the wrong background installation did not start the trigger correctly.

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

                @frederico-allan, I wasn't able to program the foreground agent on Linux to startup automatically after login. I couldn't find a standardized way to do that. If you know of a way, please let me know.

                I'm glad you got it working.

                Russell VanderMey

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