Bitcoin Forum
June 14, 2024, 07:02:28 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: TIP: Hard reboot script for BAMT / SMOS Linux  (Read 637 times)
Speedie (OP)
Sr. Member
****
Offline Offline

Activity: 504
Merit: 254


View Profile
April 01, 2014, 03:48:14 PM
 #1

*** 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!

selfabuse
Newbie
*
Offline Offline

Activity: 11
Merit: 0


View Profile
April 01, 2014, 04:57:39 PM
 #2

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!
Speedie (OP)
Sr. Member
****
Offline Offline

Activity: 504
Merit: 254


View Profile
April 01, 2014, 05:48:21 PM
 #3

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.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!