Properly shutdown pfSense by SSH command - failed…
-
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.
-
This might be helpful:
https://forum.pfsense.org/index.php?topic=65747.0
-
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.