Bitcoin Forum

Bitcoin => Hardware => Topic started by: DPoS on October 14, 2013, 04:29:47 PM



Title: KNC Miners - auto restart script
Post by: DPoS on October 14, 2013, 04:29:47 PM
A few of us have noticed that .93 will restart cgminer a fair bit when performance dips and enjoyed the better overall avg hashing
Since the other firmwares seem to not care and since there is no crontab installed....I wrote a simple shell script to auto-restart every X seconds

Place it in your /bin dir so not to care about paths, and keep a copy in your /config dir since reboots of the miner will overwrite a lot of files

I named mine tripminer.sh


#!/bin/sh
while true
do
       sh /etc/init.d/cgminer.sh restart
       sleep 9200
done


9200 seconds is about 2 1/2 hours. Change it to whatever you like.

if this helps you, a few bits in the tipjar would be nice    1Ki3sFg6bCasB6tkuMW41DCCpGFDgDHVgL




Title: Re: KNC Miners - auto restart script
Post by: btc_uzr on October 14, 2013, 04:59:46 PM
restart only in case of a crash

Code:
#!/bin/sh
while true
do
       if [ "$(pidof cgminer)" == "" ]
       then
           sh /etc/init.d/cgminer.sh restart
       fi
       sleep 10;
done


frequent restart as well as restart in case of a crash

Code:
#!/bin/sh
time=0;
restartIntervall=100; #seconds
while true
do
       if [ "$(pidof cgminer)" == "" ] || [ $(($time - $restartIntervall)) -eq 0 ]
       then
           sh /etc/init.d/cgminer.sh restart
           time=0;
       fi
       sleep 10;
       time=$(($time+10));
done

-both untested-


Title: Re: KNC Miners - auto restart script
Post by: DPoS on October 14, 2013, 05:34:02 PM
nice,

I think the best way to mimic .93 would be to monitor your pool's reading of Gh and have it restart after the avg stays below a certain limit for 3 or 5 checks in a row
Or perhaps watch cgminer's Gh and HW errors & WU and make up a suitable floor for doing the same

I know Kano has a calculation that takes all this and gives an estimate of what 'paid hashing' your miner is really doing

I am currently gaining about 40Gh more on avg just by restarting every 2 1/2 hours.. of course if a miner doesn't have issues recovering cores on its own this isn't needed


Title: Re: KNC Miners - auto restart script
Post by: mininganon on October 15, 2013, 11:20:14 PM
BUMP, this got lost in the mix there.

I'll try to play with this a bit and let you know.


Title: Re: KNC Miners - auto restart script
Post by: mininganon on October 16, 2013, 02:16:28 AM
Just restarting CGminer every so often is not bringing it back to life, it quickly loses ghs after 30min and disturbs so many cores it doesn't help. I need an auto reboot mechanism. What I need is a similar script in the init startup to reboot every 2 hours.

If anyone has suggestions


Title: Re: KNC Miners - auto restart script
Post by: mininganon on October 16, 2013, 03:56:34 AM
I ran your 1st script btc_uzr got this
sh cgrestart.sh
cgrestart.sh: line 9: syntax error: unexpected "done" (expecting "then")
[1]+  Done(127)                  bash cgrestart.sh


Title: Re: KNC Miners - auto restart script
Post by: mininganon on October 16, 2013, 11:15:17 AM
I have a $5 tip for someone who gives me working script to reboot my jupiter every so many hours. Obviously it has to be run at startup and survive reboot. I have it on .91 with the reboot mod added.  Thanks

It would be a bonus if it could detect ghs drop for x seconds then reboot as well.


Title: Re: KNC Miners - auto restart script
Post by: DPoS on October 16, 2013, 04:44:09 PM
I have a $5 tip for someone who gives me working script to reboot my jupiter every so many hours. Obviously it has to be run at startup and survive reboot. I have it on .91 with the reboot mod added.  Thanks

It would be a bonus if it could detect ghs drop for x seconds then reboot as well.

you'd be better off running the reboot.cgi URL web command from a remote computer on a looped script for that.

and since it would be driven from a remote machine, it would be possible to read the value off your pool's page and then do some type of stop limit type trigger for it

I'm not much of a web coder but I've seen stuff like this in action.  probably not hard for those into that


Title: Re: KNC Miners - auto restart script
Post by: btc_uzr on October 16, 2013, 09:24:36 PM
I ran your 1st script btc_uzr got this
sh cgrestart.sh
cgrestart.sh: line 9: syntax error: unexpected "done" (expecting "then")
[1]+  Done(127)                  bash cgrestart.sh

I assume you ran it on your desktop pc or similar, since the script executes fine on my KnCMiner; tested a min ago

On KnC devices there's no bash but sh.
/bin/sh -> /bin/busybox

and for example Ubuntu links it to dash
/bin/sh -> dash






Title: Re: KNC Miners - auto restart script
Post by: btc_uzr on October 16, 2013, 09:43:57 PM
I have a $5 tip for someone who gives me working script to reboot my jupiter every so many hours. Obviously it has to be run at startup and survive reboot. I have it on .91 with the reboot mod added.  Thanks

It would be a bonus if it could detect ghs drop for x seconds then reboot as well.

you'd be better off running the reboot.cgi URL web command from a remote computer on a looped script for that.

and since it would be driven from a remote machine, it would be possible to read the value off your pool's page and then do some type of stop limit type trigger for it

I'm not much of a web coder but I've seen stuff like this in action.  probably not hard for those into that

Good idea.

btw:
there's a nice tool/firefox plugin used for web-testing you can use with nearly zero knowledge about programming.
for reloading the status page and clicking the restart-btn in case of crash, this will do the job for you I guess
Not sure about checking a value on one page and trigger an action based on it on another webpage (check pool restart miner).
http://docs.seleniumhq.org/projects/ide/