*** Use at your own risk, I take no responsibility for any problems with the following instructions ***If you've managed BAMT or SMOS based rigs for some time, you'll probably have run into situations when a coldreboot just doesn't clear things out and a full power down / power up cycle is the only thing that works. Unfortunately that means being physically at the rig.
If you have an ACPI BIOS that accepts RTC commands (most modern BIOSes will) then you can actually perform a remote power off / on with a simple shell script.
Step 1: Ensure that you have an ACPI / RTC capable BIOS and that Linux is communicating with it correctly.
sudo ls /sys/class/rtc/rtc0/
Check for the existence of a file called wakealarm. If it's present proceed to step 2, if not you will need to check in your BIOS under the ACPI settings to enable wake on alarm or similar.
Step 2: Initialize the wakealarm file.
sudo echo 0 > /sys/class/rtc/rtc0/wakealarm
Step 3: Verify that it was initialized correctly.
sudo cat /proc/driver/rtc
You should see something like this:
rtc_time : 15:25:52
rtc_date : 2014-04-01
alrm_time : 15:30:49
alrm_date : ****-**-01
alarm_IRQ : no
alrm_pending : no
24hr : yes
periodic_IRQ : no
update_IRQ : no
HPET_emulated : yes
DST_enable : no
periodic_freq : 1024
batt_status : okay
Step 4: Create a script to power off the system and power it back up.
sudo nano /root/hardreboot.sh
Add the following code to your file:
echo "+120" > /sys/class/rtc/rtc0/wakealarm
sync
shutdown -h now
Note that 120 was chosen to give 2 minutes for the system to fully shut down, fans to stop spinning etc before the power up happens. You can change that value as needed.
Ctrl + o (the letter, not zero) and enter to write the file and Crtl + x to exit the nano editor.
Now make the script executable:
sudo chmod +x /root/hardreboot.sh
Now anytime you want to perform a hard power off / on you can just enter:
sudo /root/hardreboot.sh
Done!