Bitcoin Forum
April 19, 2024, 07:41:01 PM *
News: Latest Bitcoin Core release: 26.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Tip: how to keep miners running in linux  (Read 4921 times)
minerapia (OP)
Full Member
***
Offline Offline

Activity: 168
Merit: 100


View Profile
May 22, 2013, 07:07:29 PM
 #1

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  Cheesy

donations -> btc: 1M6yf45NskQxWXknkMTzQ8o6wShQcSY4EC
                   ltc: LeTpCd6cQL26Q1vjc9kJrTjjFMrPhrpv6j
1713555661
Hero Member
*
Offline Offline

Posts: 1713555661

View Profile Personal Message (Offline)

Ignore
1713555661
Reply with quote  #2

1713555661
Report to moderator
No Gods or Kings. Only Bitcoin
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
jbass350z
Newbie
*
Offline Offline

Activity: 24
Merit: 0


View Profile
February 15, 2014, 08:04:54 PM
 #2

Does this meed modified at all for use with BAMT?
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!