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

    How can i set rule in pfsense for rebooting

    Scheduled Pinned Locked Moved General pfSense Questions
    15 Posts 7 Posters 11.0k 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.
    • P
      phil.davis
      last edited by

      If you just want to schedule 1 reboot or shutdown, then you can do the /etc/crontab editing. Because pfSense creates /etc/crontab again when it boots, your entry will be gone - which might be exactly what you want.
      The command for reboot is:

      shutdown -r now
      

      The command for shutdown and stop (halt) is:

      shutdown -h now
      

      If you halt, then you need some other way to start again later - wake-on-LAN from another box if your hardware supports it, or press the power button.
      If you want a regular reboot or halt, then you have to install the Cron package and use the GUI to add a job to do the command at the regular times you want it.

      As the Greek philosopher Isosceles used to say, "There are 3 sides to every triangle."
      If I helped you, then help someone else - buy someone a gift from the INF catalog http://secure.inf.org/gifts/usd/

      1 Reply Last reply Reply Quote 0
      • B
        bedo_2001
        last edited by

        yes i need shutdown and work againg automaticly just for second but want this happed every 5 hour

        1 Reply Last reply Reply Quote 0
        • K
          Klaws
          last edited by

          shutdown -r +300 &
          ```will reboot the system 5 hours (300 minutes) later. If the command is issed at boot time, the system will reboot about every 301 oder 302 minutes (300 minutes plus the time required to boot up).
          
          http://doc.pfsense.org/index.php/Executing_commands_at_boot_time
          
          Since only one day in the year has 25 hours, an "every 5 hours" approach with cron might be a bit more tricky.
          1 Reply Last reply Reply Quote 0
          • N
            NOYB
            last edited by

            To get around the issue of cron being recreated at boot time mentioned by Phill.Davis.  An entry can be added to the pfSense /cf/conf/config.xml cron section so it is included in the boot time recreated /etc/crontab.

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

              A question here is: Why do you want to reboot your pfSense box every 5 hours?
              I haven't rebooted even my home box for months.

              Steve

              1 Reply Last reply Reply Quote 0
              • K
                Klaws
                last edited by

                @stephenw10:

                I haven't rebooted even my home box for months.

                So…you're still running 1.2.1? ;)

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

                  Ok, you got me, I last rebooted it when I upgraded to 2.0.2. Still more than two months ago though.  ;)

                  Steve

                  1 Reply Last reply Reply Quote 0
                  • B
                    bedo_2001
                    last edited by

                    im sory for late
                    because i have mulitgatway , if i restart my two router just only one router conected -
                    in stutes tab - gatwy - see one router is online and the another one is ofline , but after reboot my pfsense both of them is online

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

                      You shouldn't have to do that. How are you connecting to the two routers? DHCP? PPPoE bridge?

                      However to sum up the above advice:

                      • Install the crontab package.
                      • Use the crontab package to set the command 'shutdown -r now' at 5 hour intervals.

                      Steve

                      1 Reply Last reply Reply Quote 0
                      • B
                        bedo_2001
                        last edited by

                        **my system work on ESXI 4.1 , pfsense for merge 2 line my multigatwy then go to Mikrotik 5.20 for Distribution internet to clients ,
                        every route have bult in siwtch take cable form router 1 to router 2  and from router 2 cable to wan , ( i disable dhcp in bothe of them )  ( in ESXI creat  2 virual network adapter in pfsense , contact to wan by creat virtual  switch then acreat vm switch btween mikrotik an pfsense

                        this is my network every time restart my Routers only one is online and the other is offline to solve problem need to restart pfsense every time after restart routers  , hop to fond solutoin**

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