Bitcoin Forum

Bitcoin => Mining => Topic started by: minerapia on May 22, 2013, 07:07:29 PM



Title: Tip: how to keep miners running in linux
Post by: minerapia on May 22, 2013, 07:07:29 PM
This one is quite simple, it uses cron which runs periodic tasks.
You can quite easily modify this for any software, example uses cgminer.
to disable logging just remove "echo ..." lines from the watchdog.sh
this doesnt work if you run multiple instances of the same miner, also it doesnt restart dead gpus etc...
You dont need separate script in init or anything, if you use time interval short enough to start miner after boot.
This merely checks if miner process is running, thats all.


create "/home/username/start_cgminer" with following content:
Code:
screen -S cgminer -d -m cgminer --auto-fan --auto-gpu
then make it executable: "chmod 755 start_cgminer"

to keep it running i made script: "/home/username/cron/watchdog.sh"
Code:
#!/usr/bin/env bash
ps -A | grep cgminer > cgminer.status

if [[ -s cgminer.status ]] ; then
echo "running `eval date +%T_%d-%m-%Y` " >> cgminer.log
else
echo "NOT running `eval date +%T_%d-%m-%Y` " >> cgminer.log
/home/username/start_cgminer
fi;
then make it executable: "chmod 755 watchdog.sh"

start editor for user crontab: "crontab -e"
add line to the end, this runs watchdog.sh every 2 minutes.
Code:
*/2 *  *   *   *     /home/username/cron/watchdog.sh >/dev/null 2>&1

if you want different interval for example every 6 hours:
Code:
* */6  *   *   *     /home/username/cron/watchdog.sh >/dev/null 2>&1


Donations appreciated as usual  :D


Title: Re: Tip: how to keep miners running in linux
Post by: jbass350z on February 15, 2014, 08:04:54 PM
Does this meed modified at all for use with BAMT?