Freebsd is an operating system that is used primarily by system administrators as well as internet service providers. The automatic shutdown of servers based on this system can be accomplished with a simple set of commands.
Necessary
- - computer;
- - skills of working with Freebsd.
Instructions
Step 1
Ensure graceful shutdown of servers running Freebsd. To do this, make sure that a special Ssh service that has public key authentication is installed and configured in it. The server motherboard must support automatic power management. As a rule, most modern motherboards support it.
Step 2
Perform graceful shutdown of the servers running Freebsd. If its version is lower than 5.0, then add support for the Advanced Power Management function. For resource management in later versions, the Advanced Configuration and Power Interface system is used.
Step 3
To add support for this system, enable this option in Bios, then add the following line in the kernel configuration file: device apm0, then rebuild the kernel. Open the etc / rc.conf file, set the value to Yes in the apm_enable line.
Step 4
Restart your computer, then using the shutdown -p now command, you can shutdown the system with automatic power off. By default, only the Root superuser can execute this command, but you cannot give him remote access to the server.
Step 5
Therefore, use the Sudo utility to provide the ability to shutdown the system under Freebsd from a remote computer. Install it with the following command cd / usr / ports / security / sudo, then type make install clean. Edit the local / etc / sudoers file, add the server shutdown command to be executed, address and username.
Step 6
Connect to the server to shutdown the remote access. To do this, use the plink utility. Enter the following command plink -l "Enter username" -i "Enter file name, with private key> sudo shutdown -p now.