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

    Properly shutdown pfSense by SSH command - failed…

    Scheduled Pinned Locked Moved General pfSense Questions
    3 Posts 2 Posters 11.5k 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.
    • C
      Crounini
      last edited by

      Dear all,

      pfSense version: 2.1.4 Amd64 - full
      Stored in a SSD disk embedded in a special device with 6 ethernet devices.

      I am working on a automatic shutdown system created with a bash script.

      This script created a daemon in a server which check regularly the UPS with SNMP.

      If the UPS is not powered and the time remaining is low, the script shuts down my physical servers and, normaly, my pfSense router.

      To do taht (the part concerning the shutdown of pfSense) I have:
      -created a user called "user-shutodwon" in pfSense system
      -Installed sudo package
      -Grant privileges to run "sudo /etc/rc.shutdown" command to "user-shutdown"

      But… This is not working  :'( !

      I made these tests:
      -Run the command "ssh user-shutdown@pfSense sudo /etc/rc.shutdown -h" from the stopping server, and I had this response:

      pfSense is now shutting down ...

      stty: stdin isn't a terminal

      But pfSense didn't shutdown.
      I thought the problem came from the stdin allocation, so I have tried the command "ssh -t -t user-shutdown@pfSense sudo /etc/rc.shutdown -h". I had this response:
      ----------------------------------------------------------------------------------------------------------------------------------------------------                                                                                                                             
      pfSense is now shutting down ...

      Connection to charon closed.

      But pfSense didn't shutdown.

      I thought that the problem came from the argument (-h), so I have tried this: "ssh -t -t user-shutdown@pfSense sudo /etc/rc.shutdown", but same thing that before....

      Where do you think that the problem come from ?
      Should I use another command ?
      What is the procedure to follow to shutdown properly pfSense from a remote machine with SSH ?

      Thank you in advance.

      1 Reply Last reply Reply Quote 0
      • KOMK
        KOM
        last edited by

        This might be helpful:

        https://forum.pfsense.org/index.php?topic=65747.0

        1 Reply Last reply Reply Quote 0
        • C
          Crounini
          last edited by

          Arfff…

          Ok, If I've correctly understood, I do not use the correct command, I must use /sbin/shutdown -h now, like in Linux.

          Thank you KOM.

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