Title: PHP & BAMT Post by: enginehead on September 30, 2012, 11:05:28 PM 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: <?php print "Sleeping for 2 minutes\n"; sleep(120); for (;;) { $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. Title: Re: PHP & BAMT Post by: Ei Cot on September 30, 2012, 11:18:50 PM That's a very, very roundabout way to accomplish scheduled reboots.
If you really need an actual reboot, you probably should be using cron (http://en.wikipedia.org/wiki/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. Title: Re: PHP & BAMT Post by: enginehead on October 17, 2012, 07:56:39 PM 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. Title: Re: PHP & BAMT Post by: leckey on October 17, 2012, 08:00:48 PM or to save those precious bytes, shutdown -r 0 instead of now! ;D
Title: Re: PHP & BAMT Post by: Ei Cot on October 17, 2012, 08:01:59 PM 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.
Title: Re: PHP & BAMT Post by: Deafboy on October 17, 2012, 08:08:31 PM 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.
Title: Re: PHP & BAMT Post by: serp on October 17, 2012, 08:30:03 PM 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. Title: Re: PHP & BAMT Post by: enginehead on October 17, 2012, 08:31:39 PM 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. Title: Re: PHP & BAMT Post by: enginehead on October 17, 2012, 08:49:00 PM 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. |