Author

Topic: PHP & BAMT (Read 845 times)

newbie
Activity: 48
Merit: 0
October 17, 2012, 03:49:00 PM
#9
Just to make it easy you bring up a root console and type the following:
Code:
crontab -e

Add the following line to the file:
Code:
* 0,6,12,18 * * * /sbin/coldreboot

Hit Ctrl+X to exit
Y to save.


With that said, I agree that if it needs rebooted so much then you are overclocking too much or perhaps one of your cards is defective.

I have two rigs, one with 4*5850 and one with a single 5850 (and a ztex fpga) running bamt and both seemed to lockup even without major overclocking. Could be a faulty card but both rigs where running for weeks with ubuntu with no lockups. "why did you switch from ubuntu?" Mainly for the mgpumon and but having learnt more about 'screen' etc I'm thinking of switching back.
newbie
Activity: 48
Merit: 0
October 17, 2012, 03:31:39 PM
#8
If you need to reboot it every six hours, something is wrong. I had BAMT running for weaks without an issue. It crashed only when I overclocked the cores too much. Even then BAMT automagicaly rebooted the machine, so the downtime was minimal.

Yes, I am overclocking to the max, the lockups were random and bamt does not reboot. Using cgminer instead of phoenix. I'm not sure what the cause is but this is a temporary work around. Only loose a few minutes a day.
sr. member
Activity: 245
Merit: 250
@serp
October 17, 2012, 03:30:03 PM
#7
Just to make it easy you bring up a root console and type the following:
Code:
crontab -e

Add the following line to the file:
Code:
* 0,6,12,18 * * * /sbin/coldreboot

Hit Ctrl+X to exit
Y to save.


With that said, I agree that if it needs rebooted so much then you are overclocking too much or perhaps one of your cards is defective.
hero member
Activity: 482
Merit: 502
October 17, 2012, 03:08:31 PM
#6
If you need to reboot it every six hours, something is wrong. I had BAMT running for weaks without an issue. It crashed only when I overclocked the cores too much. Even then BAMT automagicaly rebooted the machine, so the downtime was minimal.
newbie
Activity: 21
Merit: 0
October 17, 2012, 03:01:59 PM
#5
FWIW: The shutdown process requires syncing then unmounting all mounted filesystems immediately before doing a power cycle.  Regardless, you can just substitute the proper command.
sr. member
Activity: 434
Merit: 250
October 17, 2012, 03:00:48 PM
#4
or to save those precious bytes, shutdown -r 0 instead of now!  Grin
newbie
Activity: 48
Merit: 0
October 17, 2012, 02:56:39 PM
#3
good point, but you don't get the point. 'coldreboot' is the command I needed. not just a shutdown -r. Already had php installed to run other stuff. custom overclocking etc. Coldreboot insures that the usb thumb is synced before rebooting. Guess you could sync and then reboot from cron as you had suggested. However the php snippet I posted is only part of an overclocking and temp control script I have running already. So more suitable for my needs.

as I said "works for me!"

Thanks for your input Ei Cot. I do need to look into cron more though.
newbie
Activity: 21
Merit: 0
September 30, 2012, 06:18:50 PM
#2
That's a very, very roundabout way to accomplish scheduled reboots.

If you really need an actual reboot, you probably should be using cron instead of creating a freaking PHP-based daemon.

Given that BAMT seems to be based on Debian, you can probably insert a cron job similar to:

Code:
* 0,6,12,18 * * * /sbin/shutdown -r now

That's a heck of a lot easier than installing PHP and manually adding a system service.  The "-r" in that command schedules a reboot, and the "now" schedules it for, well, right then and there.

Of course, if you have to reboot your server every six hours, you should probably look into the actual thing going wrong rather than just punting and rebooting the darn thing.
newbie
Activity: 48
Merit: 0
September 30, 2012, 06:05:28 PM
#1
Using BAMT but I've found that it needs an occasional 'coldreboot' to keep it stable.

So I installed PHP.

SSH in as root 'apt-get install php5-cli'

SSH in as user 'nano auto-reboot.php'

paste the code below:

print "Sleeping for 2 minutes\n";
sleep(120);
for (;Wink
        {
        $hour = date('G');
        $minute = date('i');
        print $hour.$minute."\n";
        if ($hour == 0 or $hour == 6 or $hour == 12 or $hour == 18)
                {
                if ($minute == 10)
                        {
                        $output = shell_exec('coldreboot');
                        }
                }
        sleep(30);
        }
?>

press ctrl+x

press y

then go back to your root SSH session.

type "nano /etc/rc.local"

edit the file so it looks like this

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
screen -dmS auto-reboot php -cp home/user/auto-reboot.php
exit 0


press ctrl+x

press y

coldreboot

this will reboot you rig every six hours.

edit
$hour == 0 or $hour == 6 or $hour == 12 or $hour == 18

if you wish.

Works for me.
Jump to: