Wednesday, 26 March 2014

Automatic restart of Litecoin minerd on Linux

I wrote this small script so that I don't have to connect to my Litecoin CPU mining servers when there is connection error or minerd just stops to work.

Here is the script

root@sysresccd /opt % cat res.sh
#!/bin/bash
set -x
a=`cat /proc/cpuinfo|grep processor |wc -l`
echo $a
b=`locate minerd|head -n 1`
if [ `ps aux|grep miner|wc -l` -ge 2 ]
then
echo 0
else
echo 1
$b -B -S -o scrypt -r 1 -t $a -s 6 -o http://URL:PORT -u yourusername.1 -p 1
fi



I put this script in crontab to execute every minute.

You must execute updatedb before running this script so that it can find location of minerd. It is only needed once to do this.




No comments: