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

    Config file keeps getting reset

    General Discussion
    2
    5
    274
    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.
    • ?
      A Former User
      last edited by

      Hey all,

      I added some new triggers, but they keep getting removed. I've checked their format and they seem okay, but i might be missing something.

        {"trigger":"Shutdown PC","command":"ssh user@pc.local "shutdown -s -t 60"","ground":"background","voice":"Shutdown my PC","allowParams": "false"},
        {"trigger":"Restart PC","command":"ssh user@pc.local "shutdown -r -t 60"","ground":"background","voice":"Restart my PC","allowParams": "false"},
        {"trigger":"Hibernate PC","command":"ssh user@pc.local "shutdown -h -t 60"","ground":"background","voice":"Hibernate my PC","allowParams": "false"},
        {"trigger":"Sleep PC","command":"ssh user@pc.local "nircmd standby"","ground":"background","voice":"Sleep my PC","allowParams": "false"},
        {"trigger":"Abort PC","command":"ssh user@pc.local "shutdown -a"","ground":"background","voice":"Abort","allowParams": "false"}
      
      

      Console output of installdaemon.sh

      
      pi@pihole:~ $ sudo /usr/share/triggercmdagent/app/src/installdaemon.sh
      Daemon install: true
      Logging in with saved token.
      Checking if the 5e861xxxxxxxxxxxxx193d3fe6 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: enabled)
         Active: active (running) since Sat 2020-04-04 12:23:29 BST; 3 days ago
       Main PID: 275 (node)
         Memory: 33.7M
         CGroup: /system.slice/triggercmdagent.service
                 └─275 node /usr/share/triggercmdagent/app/src/daemon.js --run /root/.TRIGGERcmdData
      
      Apr 07 19:04:38 pihole env[275]: Write backup completed.
      Apr 07 19:04:39 pihole env[275]: Initiated command removals
      Apr 07 19:04:39 pihole env[275]: Initiated command adds
      Apr 07 19:04:39 pihole env[275]: Failed while trying add a trigger.
      Apr 07 19:04:39 pihole env[275]: Failed while trying add a trigger.
      Apr 07 19:04:39 pihole env[275]: Failed while trying add a trigger.
      Apr 07 19:04:39 pihole env[275]: Failed while trying add a trigger.
      Apr 07 19:04:39 pihole env[275]: Failed while trying add a trigger.
      Apr 07 19:04:39 pihole env[275]: Failed while trying add a trigger.
      Apr 07 19:05:28 pihole env[275]: Failed while trying add a trigger.
      

      Thanks!

      RussR 1 Reply Last reply Reply Quote 0
      • RussR
        Russ @A Former User
        last edited by

        @Lewis-S, I see two quotes in a row at the end of your commands. There should be only one.

        When the agent sees invalid json it reverts the file to the previous version.

        Russell VanderMey

        1 Reply Last reply Reply Quote 0
        • ?
          A Former User
          last edited by

          That makes sense.

          My commands need the quotes. Is there anyway of not needing to make scripts for each trigger?
          I read online somewhere about escape characters, but I'm not sure where I'd need them.

          Thanks

          RussR 1 Reply Last reply Reply Quote 0
          • RussR
            Russ @A Former User
            last edited by Russ

            @Lewis-S, to use quotes within quotes you generally have to "escape" them with backslashes. Like this:

            "She said \"hi\" to me"
            

            Russell VanderMey

            ? 1 Reply Last reply Reply Quote 0
            • ?
              A Former User @Russ
              last edited by A Former User

              @Russ I see.

              It works, but the command is not working when it gets executed, as the ""s are being interpreted.

              I guess I'll have to use script files after all.

              Thank you very much!

              Edit: (split)

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