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

Null computer when running background task

General Discussion
2
3
255
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.
  • J
    jesgomp
    last edited by Nov 1, 2020, 11:22 AM

    Hi, I am running on OSMC with a raspberry pi 3b+, and if I execute fom the terminal triggercmdagent, it all works properly as expected. It connects with a computer.
    The output is the following.

    Run installdaemon.sh to install the triggercmdagent daemon so it runs during boot
    Daemon install: false
    Logging in with saved token.
    Checking if the 845412155412 computer exists.
    This computer exists in your account.
    Tokenfile: /home/osmc/.TRIGGERcmdData/token.tkn
    ComputerIDfile: /home/osmc/.TRIGGERcmdData/computerid.cfg
    Logging in with saved token to run foreground 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.1.13)
             Connected at: Sat Oct 31 2020 19:51:34 GMT+0100 (Central European Standard Time)
    
    
    
    Initiated command removals
    Initiated command adds
    
    { message: 'Subscribed to dsgf9gsrherhreb1d52!' }
    { message: 'Subscribed to dsgf9gsrherhreb1d52!' }
    
    

    But when I try to install the triggercmdagent daemon so it runs during boot with

    sudo /usr/share/triggercmdagent/app/src/installdaemon.sh
    

    the output is the next

    osmc@salon:/usr$ sudo /usr/share/triggercmdagent/app/src/installdaemon.sh
    Daemon install: true
    Logging in with saved token.
    Checking if the null computer exists.
    This computer was deleted from your account.  Login to recreate it.
    * triggercmdagent.service - TRIGGERcmd Agent
       Loaded: loaded (/etc/systemd/system/triggercmdagent.service; enabled; vendor preset: enable
       Active: active (running) since Sat 2020-10-31 19:57:36 CET; 655ms ago
     Main PID: 1371 (node)
       Memory: 2.6M
       CGroup: /system.slice/triggercmdagent.service
               `-1371 node /usr/share/triggercmdagent/app/src/daemon.js --run /root/.TRIGGERcmdDat
    
    Oct 31 19:57:36 salon systemd[1]: Started TRIGGERcmd Agent.
    

    The json file is the next:

    [
      {"trigger":"Reboot","command":"shutdown -r","ground":"background","voice":"reboot","allowParams": "false"},
      {"trigger":"Gnome Editor","command":"gedit","ground":"foreground","voice":"edit","allowParams": "false"},
      {"trigger":"apagar","command":"shutdown -h now","ground":"background","voice":"apagar","allowParams": "false"},
      {"trigger":"apagardos","command":"shutdown -h now","ground":"foreground","voice":"apagardos","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"}
    ]
    

    I do not understand why it does not get the computer, from the same file ComputerIDfile: /home/osmc/.TRIGGERcmdData/computerid.cfg, and how to fix it.

    I would really appreciate some help,

    R 1 Reply Last reply Nov 1, 2020, 2:27 PM Reply Quote 0
    • R
      Russ @jesgomp
      last edited by Russ Nov 1, 2020, 2:32 PM Nov 1, 2020, 2:27 PM

      @jesgomp, on the Raspberry Pi, people generally install the agent with the root user, but you can make it work with your osmc user.

      Please edit your /etc/systemd/system/triggercmdagent.service file, and change that /root/.TRIGGERcmdData path to /home/osmc/.TRIGGERcmdData

      [Unit]
      Description=TRIGGERcmd Agent
      
      [Service]
      Type=simple
      ExecStart=/usr/bin/env node /usr/share/triggercmdagent/app/src/daemon.js --run /root/.TRIGGERcmdData
      User=root
      Restart=always
      
      [Install]
      WantedBy=default.target
      

      Then restart the agent with this command:

      systemctl restart triggercmdagent
      

      The agent will still run as root, but it should use your .TRIGGERcmdData folder in your osmc user's home folder.

      Russell VanderMey

      1 Reply Last reply Reply Quote 0
      • J
        jesgomp
        last edited by Nov 1, 2020, 6:28 PM

        Thanks for your quick response, now it works fine

        1 Reply Last reply Reply Quote 0
        1 out of 3
        • First post
          1/3
          Last post