123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- #!/bin/sh /etc/rc.common
- #set -x
- START=99
- APP=cgminer
- PID_FILE=/var/run/$APP.pid
- start() {
- local _pool1url
- local _pool1user
- local _pool1pw
- local _pool2url
- local _pool2user
- local _pool2pw
- local _pool3url
- local _pool3user
- local _pool3pw
- local _pb
- local _ow
- local _bec
- local _aa
- local _mo
-
- local _freq
- local _volt
- config_load cgminer
- config_get _pool1url default pool1url
- config_get _pool1user default pool1user
- config_get _pool1pw default pool1pw
- config_get _pool2url default pool2url
- config_get _pool2user default pool2user
- config_get _pool2pw default pool2pw
- config_get _pool3url default pool3url
- config_get _pool3user default pool3user
- config_get _pool3pw default pool3pw
- config_get _pb default pool_balance
- config_get _ow default bitmain_tempoverctrl
- config_get _bec default bitmain_beeper
- config_get _aa default api_allow
- config_get _mo default more_options
- config_get _xn default xnsub_options
- config_get _freq default freq
- config_get _volt default voltage
- if [ "$_volt" != "" ]; then
- VOPT="--bitmain-voltage $_volt"
- fi
- if [ "$_pool1url" != "" -a "$_pool1user" != "" -a "$_pool1pw" != "" ]; then
- POOL1="-o $_pool1url -O $_pool1user:$_pool1pw"
- fi
- if [ "$_pool2url" != "" -a "$_pool2user" != "" -a "$_pool2pw" != "" ]; then
- POOL2="-o $_pool2url -O $_pool2user:$_pool2pw"
- fi
- if [ "$_pool3url" != "" -a "$_pool3user" != "" -a "$_pool3pw" != "" ]; then
- POOL3="-o $_pool3url -O $_pool3user:$_pool3pw"
- fi
- BITOPT="--bitmain-options 115200:32:8 --bitmain-freq $_freq"
- POOLOPT="$POOL1 $POOL2 $POOL3 $_pb"
- APIOPT="--api-listen --api-allow $_aa"
- OTHEROPT="--bitmain-checkn2diff --bitmain-hwerror $_ow $_bec"
- PARAMS="$BITOPT $VOPT $POOLOPT $APIOPT $OTHEROPT $_mo $_xn"
- sleep 1
- cnt=0
- while [ "$cnt" != "3" -a "$NTPD_RET" != "0" ] ; do
- ntpd -d -n -q -N \
- -p 0.openwrt.pool.ntp.org \
- -p 1.openwrt.pool.ntp.org \
- -p 2.openwrt.pool.ntp.org \
- -p 3.openwrt.pool.ntp.org &> /dev/null
- NTPD_RET="$?"
- cnt=$(($cnt+1))
- sleep 1
- done
- echo $cnt
- echo $PARAMS
- start-stop-daemon -S -x $APP -p $PID_FILE -m -b -- $PARAMS
- }
- stop() {
- start-stop-daemon -K -n $APP -p $PID_FILE -s TERM
- }
|