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

    PI Hole command not working

    General Discussion
    2
    10
    455
    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.
    • T
      TI_Gaming_TV
      last edited by

      I followed all the instructions given by Russ. The trigger on and off are going to my pi (i can see it over the console). Parameter off was send, but he pihole_on_off.sh file not working do not send pihole enable (same with on).

      1 Reply Last reply Reply Quote 0
      • T
        TI_Gaming_TV
        last edited by

        I needed to change file permissions.
        Now i get this:

        
        /root/.TRIGGERcmdData/pihole_on_off.sh: line 2: syntax error near unexpected token '§'in\r'
        'root/. TRIGGERcmdData/pihole_on_off.sh: line 2: 'case "$1" in
        
        
        RussR 1 Reply Last reply Reply Quote 0
        • RussR
          Russ @TI_Gaming_TV
          last edited by

          @TI_Gaming_TV, can you copy/paste your script here? You seem to have an error on line 2.

          Russell VanderMey

          T 1 Reply Last reply Reply Quote 0
          • T
            TI_Gaming_TV @Russ
            last edited by

            @Russ

            
            root@DietPi:~# cat / root/. TRIGGERcmdData/pihole_on_off.sh 
            #/bin/bash 
            case "$1" in
            "on")
            pihole enable
            "off")
            pihole disable
            *)
            echo "Run this with on or off as the parameter."
            exit 1
            ;;
            esac 
            
            
            RussR 1 Reply Last reply Reply Quote 0
            • RussR
              Russ @TI_Gaming_TV
              last edited by

              @TI_Gaming_TV, you're missing these lines:

              ;;
              

              Please try this:

              #!/bin/bash
              case "$1" in
                "on")
                  pihole enable
                  ;;
                "off")
                  pihole disable
                  ;;
                *)
                  echo "Run this with on or off as the parameter."
                  exit 1
                  ;;
              esac
              

              Russell VanderMey

              T 1 Reply Last reply Reply Quote 0
              • T
                TI_Gaming_TV @Russ
                last edited by

                @Russ sry. The ;; weren’t copied because I used the iPhone photo scan. That’s not the problem

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

                  @TI_Gaming_TV, I thought that was it because I got a similar error when I used the script you pasted above, although the error was on a different line.

                  ./pihole_on_off.sh: line 5: syntax error near unexpected token `)'
                  ./pihole_on_off.sh: line 5: `"off")'
                  

                  Can you copy/paste your actual script text here?

                  Russell VanderMey

                  T 2 Replies Last reply Reply Quote 0
                  • T
                    TI_Gaming_TV @Russ
                    last edited by

                    @Russ

                    #/bin/bash
                    case "$1" in
                      "on")
                        pihole enable
                        ;;
                      "off")
                        pihole disable
                        ;;
                      *)
                        echo "Run this with on or off as the parameter."
                        exit 1
                        ;;
                    esac
                    
                    
                    1 Reply Last reply Reply Quote 0
                    • T
                      TI_Gaming_TV @Russ
                      last edited by

                      @Russ now i know the problem. it was the !# in line 1. I forgot the !

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

                        @TI_Gaming_TV, awesome. So it's working now?

                        Russell VanderMey

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