Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Create backup using a script

    Scheduled Pinned Locked Moved General pfSense Questions
    10 Posts 2 Posters 905 Views
    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.
    • D
      droidus
      last edited by

      I am trying to backup my pfsense device using this script: https://github.com/blogmotion/bm-backup-pfsense/blob/master/pfmotion_curl.sh. After adding in the custom parameters and running, I am running into the following:

      !!! URL ERROR (https://192.168.0.1): HTTP OR HTTPS ?
      

      When I access the web gui, I use HTTPS, and I am able to login.
      Here is the relevant code in the script:

      # xml file contains doctype when the URL is wrong
      if grep -qi 'doctype html' $CONFIG_TMP; then
      	echo ; echo "   !!! URL ERROR (${PFSENSE_HOST}): HTTP OR HTTPS ?"; echo
      	rm -f $CONFIG_TMP
      	exit 1
      fi
      

      I am not sure where to go from here, and how to fix it.

      1 Reply Last reply Reply Quote 0
      • stephenw10S
        stephenw10 Netgate Administrator
        last edited by

        @droidus said in Create backup using a script:

        rm -f $CONFIG_TMP

        Try commenting out rm -f $CONFIG_TMP and re-run it. Then check that file to see what it actually pulled.
        It looks like that error is supposed to indicate it downloaded a web page and not the config file.

        Steve

        D 1 Reply Last reply Reply Quote 0
        • D
          droidus @stephenw10
          last edited by

          @stephenw10 Here is what that tmp file starts with:

          <!DOCTYPE html>
          
          1 Reply Last reply Reply Quote 0
          • stephenw10S
            stephenw10 Netgate Administrator
            last edited by

            So the URL is probably wrong, like it says. How do you usually access the firewall?

            D 1 Reply Last reply Reply Quote 0
            • D
              droidus @stephenw10
              last edited by

              @stephenw10 Through the web interface.

              1 Reply Last reply Reply Quote 0
              • stephenw10S
                stephenw10 Netgate Administrator
                last edited by

                I mean what URL exactly do you use?

                D 1 Reply Last reply Reply Quote 0
                • D
                  droidus @stephenw10
                  last edited by

                  @stephenw10 https://<ip>/firewall_rules.php
                  What does the fw have to do with backup?

                  1 Reply Last reply Reply Quote 0
                  • stephenw10S
                    stephenw10 Netgate Administrator
                    last edited by

                    The error you are seeing indicates you have entered the wrong URL.

                    So what have you set as the PFSENSE_HOST variable?

                    What URL do you usually use to access pfSense that you know works?

                    That things must match.

                    Steve

                    D 1 Reply Last reply Reply Quote 0
                    • D
                      droidus @stephenw10
                      last edited by

                      @stephenw10 It is https://<ip>. I type it into my browser, and it loads, so I know it is the right IP.

                      1 Reply Last reply Reply Quote 0
                      • stephenw10S
                        stephenw10 Netgate Administrator
                        last edited by stephenw10

                        No trailing slash? Standard port?

                        Without seeing the actual file you're using we can only guess.

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post
                        Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.