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

    Automatic periodic reboot howto?

    Scheduled Pinned Locked Moved General pfSense Questions
    11 Posts 5 Posters 9.7k 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
      dracunciliasis
      last edited by

      Hello
      Does any one know how to make a script ro perform automatic periodic reboots?
      For instance I want to reboot my PFSENSE every day at 3 AM; or For instance I want to reboot my PFSENSE every week at saturday day at 3 AM.

      Dracunciliasis

      1 Reply Last reply Reply Quote 0
      • H
        hoba
        last edited by

        Why do you want to do this?

        However, look at diagnostics>edit file and open "/etc/crontab" and schedule your reboot there if needed.

        1 Reply Last reply Reply Quote 0
        • S
          sullrich
          last edited by

          If you want to use wget remotely (btw: this was sent to the mailing list this week, slightly modified):

          wget -qO /tmp/config_backup.xml –user=admin --password=pfsense --no-check-certificate "https://192.168.1.1/exec_raw.php?cmd=shutdown -r now"

          1 Reply Last reply Reply Quote 0
          • D
            dracunciliasis
            last edited by

            @hoba:

            Why do you want to do this?

            However, look at diagnostics>edit file and open "/etc/crontab" and schedule your reboot there if needed.

            I've run this command  "/sbin/reboot" on the Diagnostics: Execute command just to chekout if the line that would be added  to the "/etc/crontab" would do no arm to the system and the system just hanged.

            @sullrich:

            If you want to use wget remotely (btw: this was sent to the mailing list this week, slightly modified):

            wget -qO /tmp/config_backup.xml –user=admin --password=pfsense --no-check-certificate "https://192.168.1.1/exec_raw.php?cmd=shutdown -r now"

            wget ?!? what's the purpose of wget in getting it rebooted automatically?

            1 Reply Last reply Reply Quote 0
            • H
              hoba
              last edited by

              @dracunciliasis:

              @hoba:

              Why do you want to do this?

              However, look at diagnostics>edit file and open "/etc/crontab" and schedule your reboot there if needed.

              I've run this command  "/sbin/reboot" on the Diagnostics: Execute command just to chekout if the line that would be added  to the "/etc/crontab" would do no arm to the system and the system just hanged.

              @sullrich:

              If you want to use wget remotely (btw: this was sent to the mailing list this week, slightly modified):

              wget -qO /tmp/config_backup.xml –user=admin --password=pfsense --no-check-certificate "https://192.168.1.1/exec_raw.php?cmd=shutdown -r now"

              wget ?!? what's the purpose of wget in getting it rebooted automatically?

              wget executes the "shutdown -r now" command via diagnostics>command for you. See it like a kind of "remote procedure call". Btw, this is also the command you should run in crontab.

              1 Reply Last reply Reply Quote 0
              • F
                far_ken_beauty
                last edited by

                @sullrich:

                If you want to use wget remotely (btw: this was sent to the mailing list this week, slightly modified):

                wget -qO /tmp/config_backup.xml –user=admin --password=pfsense --no-check-certificate "https://192.168.1.1/exec_raw.php?cmd=shutdown -r now"

                Sorry to bring this thread up again but when I run the command below from my windows machine I get…"/tmp/config_backup.xml: No such file or directory.

                I would like to remotely shutdown my pfsense machine from my windows machine.

                wget -qO /tmp/config_backup.xml --user=admin --password=pfsense --no-check-certificate "https://192.168.1.1/exec_raw.php?cmd=shutdown -r now"

                1 Reply Last reply Reply Quote 0
                • S
                  sullrich
                  last edited by

                  /tmp/ is a unix directory.  you most likely want to substitute it for something like c:\mybackup\ etc

                  1 Reply Last reply Reply Quote 0
                  • F
                    far_ken_beauty
                    last edited by

                    Thanks I created the config_backup.xml as an empty file and now it works.
                    Many thanks.

                    1 Reply Last reply Reply Quote 0
                    • D
                      DanielSHaischt
                      last edited by

                      Hint: Never ever edit /etc/crontab directly. It is getting regenerated during each reboot. So your changes may be lost after a reboot.

                      Cheers
                      Daniel S. Haischt

                      Mit freundlichen Gruessen / With kind regards
                      DAn.I.El S. Haischt

                      1 Reply Last reply Reply Quote 0
                      • F
                        far_ken_beauty
                        last edited by

                        I created the config_backup.xml file locally on my windows machine and put it in the same folder as wget.
                        Running this works…
                        wget -qO config_backup.xml --user=admin --password=pfsense --no-check-certificate "https://192.168.0.2/exec_raw.php?cmd=shutdown -r now"

                        Is that OK to do?

                        1 Reply Last reply Reply Quote 0
                        • D
                          DanielSHaischt
                          last edited by

                          Yes!

                          Mit freundlichen Gruessen / With kind regards
                          DAn.I.El S. Haischt

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