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

Script doesn't seem to finish running

General Discussion
2
3
114
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 Apr 3, 2020, 5:28 PM

    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

    R 1 Reply Last reply Apr 3, 2020, 7:37 PM Reply Quote 0
    • R
      Russ @A Former User
      last edited by Apr 3, 2020, 7:37 PM

      @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 Apr 4, 2020, 11:35 AM

        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
        1 out of 3
        • First post
          1/3
          Last post