Checks minerd is running

#!/bin/bash
while true; do
        running=`ps -ef | grep minerd | wc -l`
        maxnum=`cat /proc/cpuinfo | grep processor | wc -l`

        # check minerd is running – remember that the ps command output will include the command itself, henve 2
        if [ $running -lt 2 ]; then
                echo No minerd found: starting minerd
                ./minerd -a cryptonight -o qcn.ext-pool.net:3003 -u username -p x -t 7 -q 2>> minerd.log &
        fi

        # check for boooo in the minerd output
        boos=`grep ‘boooo’ minerd.log | wc -l`
        if [ $boos -gt 0 ]; then
                rm minerd.log
                echo Found $boos boos
                #restart minerd
                killall minerd && sleep 5
                ./minerd -a cryptonight -o qcn.ext-pool.net:3003 -u username -p x -t 7 -q 2>> minerd.log &
        else
                echo No booos found
                sleep 10
        fi
done;

上一篇: