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

    Script doesn't seem to finish running

    General Discussion
    2
    3
    97
    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,

      I've got a script that gets triggered by Alexa/Shortcuts/Button/QR etc, that disables my PiHole for an hour.
      I've got this script:

      # Combo of pihole-enable-delay and pihole-disable
      
      date
      pihole disable
      curl --data "param1=value1&param2=value2" https://maker.ifttt.com/trigger/pihole_disabled/with/key/b7GK*********-Z4lsit2o
      
      sleep 3600
      #sleep 10
      
      pihole enable
      curl --data "param1=value1&param2=value2" https://maker.ifttt.com/trigger/pihole_enabled/with/key/b7GK************-Z4lsit2o
      
      

      The runs for the first half, but seems to stop when it gets to the sleep command.

      Any ideas?

      Thank you

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

        @Lewis-S, what if you run that from a bash prompt while you're ssh'ed into the Pi?

        This is what I get:

        pi@pi:~ $ ./test.sh
        Fri  3 Apr 19:31:08 UTC 2020
        ./test.sh: line 2: pihole: command not found
        {"errors":[{"message":"You sent an invalid key."}]}./test.sh: line 8: pihole: command not found
        {"errors":[{"message":"You sent an invalid key."}]}
        

        To confirm whether it's running the commands after the sleep, can you add a line like this to see if it creates the log file?

        echo Testing after the sleep > /tmp/log.log
        

        I did that and I get the log file, including if I run it via TRIGGERcmd:

        pi@garagepi:~ $ cat /tmp/log.log
        Testing after the sleep
        

        My commands.json entry looks like this:

        {"trigger":"testsh","command":"\/home\/pi\/test.sh","ground":"background","voice":"test"},
        

        Russell VanderMey

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

          Hi Russ,

          It runs fine if I run it from a prompt, but does seem to be getting caught up on the curls, which it has not previously.
          I'll have to look at that, I'm doing some network changes so that's probably not helping.

          log.log does seem to appear after running it via TriggerCMD.

          Thanks again!

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