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

    Shutdown via script over (W)LAN

    Scheduled Pinned Locked Moved General pfSense Questions
    13 Posts 3 Posters 3.9k 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.
    • T Offline
      tommyboy180
      last edited by

      What does shutting down the "cop" do? Does this disable the firewall, shutdown the system, or something else?

      I'm sure we can help you find a simple script written in php.

      -Tom Schaefer
      SuperMicro 1U 2X Intel pro/1000 Dual Core Intel 2.2 Ghz - 2 Gig RAM

      Please support pfBlocker | File Browser | Strikeback

      1 Reply Last reply Reply Quote 0
      • GruensFroeschliG Offline
        GruensFroeschli
        last edited by

        IP/halt.php
        You could call this page with curl.

        We do what we must, because we can.

        Asking questions the smart way: http://www.catb.org/esr/faqs/smart-questions.html

        1 Reply Last reply Reply Quote 0
        • S Offline
          schnubert
          last edited by

          Hi!

          Thanks for the fast response.

          What does shutting down the "cop" do?

          Yes, It halts the system.

          IP/halt.php
          You could call this page with curl.

          This sounds quite nice already but I ve little issue with curl as I want to do the shutdown from several Systems(eg. Linux, iPhone, Mac, Windows,  -curl needs to get "installed") and I was used to more or less just open that URL in whatever browser I want and it halted the system without prompting for credentials.

          I am grateful for any hint  ;)

          1 Reply Last reply Reply Quote 0
          • T Offline
            tommyboy180
            last edited by

            Try the page on your device and see it it works. If not just create your own.

            A simple script may look like

            // Halts the system when the page is browsed
            // No authentication required (insecure)
            echo exec('shutdown -h now');
            ?>
            
            

            And save that to /usr/local/www/halt.php or whatever you want to name it.

            -Tom Schaefer
            SuperMicro 1U 2X Intel pro/1000 Dual Core Intel 2.2 Ghz - 2 Gig RAM

            Please support pfBlocker | File Browser | Strikeback

            1 Reply Last reply Reply Quote 0
            • S Offline
              schnubert
              last edited by

              @tommyboy180:

              Try the page on your device and see it it works. If not just create your own.

              A simple script may look like

              // Halts the system when the page is browsed
              // No authentication required (insecure)
              echo exec('shutdown -h now');
              ?>
              
              

              And save that to /usr/local/www/halt.php or whatever you want to name it.

              Worked like a charme …  ;D ;D ;D
              I just replaced "shutdown -h now" with a "shutdown -p now"

              Thanks a lot!

              1 Reply Last reply Reply Quote 0
              • T Offline
                tommyboy180
                last edited by

                Why shutdown -p? That just sounds unsafe.

                -Tom Schaefer
                SuperMicro 1U 2X Intel pro/1000 Dual Core Intel 2.2 Ghz - 2 Gig RAM

                Please support pfBlocker | File Browser | Strikeback

                1 Reply Last reply Reply Quote 0
                • S Offline
                  schnubert
                  last edited by

                  @tommyboy180:

                  Why shutdown -p? That just sounds unsafe.

                  With shutdown -h the system does not powerdown but with -p it does…

                  Why do you mean -p is unsafe?  ???

                  1 Reply Last reply Reply Quote 0
                  • T Offline
                    tommyboy180
                    last edited by

                    shutdown -h does poweroff. Shutdown -h will halt the system and poweroff

                    shutdown -p will just power it off so it's the same as pulling the power. That's bad.

                    -Tom Schaefer
                    SuperMicro 1U 2X Intel pro/1000 Dual Core Intel 2.2 Ghz - 2 Gig RAM

                    Please support pfBlocker | File Browser | Strikeback

                    1 Reply Last reply Reply Quote 0
                    • S Offline
                      schnubert
                      last edited by

                      hmmm I am confused now….
                      According to the BSD manpage http://www.freebsd.org/cgi/man.cgi?query=shutdown&sektion=8

                      -h      The system is halted at the specified time.

                      -p      The system is halted and the power is turned off (hardware support required) at the specified time.

                      …or do I understand something wrong here?  ???

                      1 Reply Last reply Reply Quote 0
                      • T Offline
                        tommyboy180
                        last edited by

                        I know that -h will halt and shutdown because that's what I use. I guess you could experiment and see which one works best for you.

                        Let me know what you find out.

                        -Tom Schaefer
                        SuperMicro 1U 2X Intel pro/1000 Dual Core Intel 2.2 Ghz - 2 Gig RAM

                        Please support pfBlocker | File Browser | Strikeback

                        1 Reply Last reply Reply Quote 0
                        • S Offline
                          schnubert
                          last edited by

                          Hey!

                          I did some tests already and found out that with shutdown -h the system is doing a shutdown but it remains powered(on the screen you can read "press any key to reboot")

                          With shutdown -p system will be get "shutdowned" and powered off….

                          Maybe this behavior differs from system to system...?

                          1 Reply Last reply Reply Quote 0
                          • T Offline
                            tommyboy180
                            last edited by

                            Yeah, it has to differ from system to system.
                            I use shutdown -h all the time and it cuts the power after the shutdown process completes.

                            Well I'm glad the php script worked for you. Take care!

                            -Tom Schaefer
                            SuperMicro 1U 2X Intel pro/1000 Dual Core Intel 2.2 Ghz - 2 Gig RAM

                            Please support pfBlocker | File Browser | Strikeback

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