Author

Topic: TIP: Hard reboot script for BAMT / SMOS Linux (Read 651 times)

sr. member
Activity: 504
Merit: 254
Oooh - thanks! I have had the exact problem that you describe, and have lost several days worth of mining when I tried to reboot from my office only to have the machine hang. I figured it was just me since my rig is held together with zip ties - nice to hear I'm not the only one having that problem.

Thanks again!

No, it's not just you. Occasionally one of my rigs will have a CGMiner hang, and a look in the logs shows atitweak throwing a hissy fit. A coldreboot often fails to fix it and the same atitweak errors show up in dmesg. For whatever reason a full off/on power cycle cures what ails it.
newbie
Activity: 11
Merit: 0
Oooh - thanks! I have had the exact problem that you describe, and have lost several days worth of mining when I tried to reboot from my office only to have the machine hang. I figured it was just me since my rig is held together with zip ties - nice to hear I'm not the only one having that problem.

Thanks again!
sr. member
Activity: 504
Merit: 254
*** 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.

Code:
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.

Code:
sudo echo 0 > /sys/class/rtc/rtc0/wakealarm

Step 3: Verify that it was initialized correctly.

Code:
sudo cat /proc/driver/rtc

You should see something like this:

Code:
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.

Code:
sudo nano /root/hardreboot.sh

Add the following code to your file:

Code:
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:

Code:
sudo chmod +x /root/hardreboot.sh

Now anytime you want to perform a hard power off / on you can just enter:

Code:
sudo /root/hardreboot.sh

Done!

Jump to: