Root/cgminer/files/cgminer.init

Source at commit 8b7a89168c777ee394adff8070b29581ebf46ba8 created 7 years 1 month ago.
By Xiangfu, cgmienr: add a webui, update to 2.10.5
1#!/bin/sh /etc/rc.common
2START=99
3
4APP=cgminer
5PID_FILE=/var/run/$APP.pid
6
7start() {
8    local _pool1url
9    local _pool1user
10    local _pool1pw
11
12    local _pool2url
13    local _pool2user
14    local _pool2pw
15
16    local _pool3url
17    local _pool3user
18    local _pool3pw
19
20    config_load cgminer
21
22    config_get _pool1url default pool1url
23    config_get _pool1user default pool1user
24    config_get _pool1pw default pool1pw
25    config_get _pool2url default pool2url
26    config_get _pool2user default pool2user
27    config_get _pool2pw default pool2pw
28    config_get _pool3url default pool3url
29    config_get _pool3user default pool3user
30    config_get _pool3pw default pool3pw
31
32    if [ "$_pool1url" != "" -a "$_pool1user" != "" -a "$_pool1pw" != "" ]; then
33        POOL1="-o $_pool1url -O $_pool1user:$_pool1pw"
34    fi
35    if [ "$_pool2url" != "" -a "$_pool2user" != "" -a "$_pool2pw" != "" ]; then
36        POOL2="-o $_pool2url -O $_pool2user:$_pool2pw"
37    fi
38    if [ "$_pool3url" != "" -a "$_pool3user" != "" -a "$_pool3pw" != "" ]; then
39        POOL3="-o $_pool3url -O $_pool3user:$_pool3pw"
40    fi
41
42    DEVS=`find /dev/ -type c -name "ttyUSB*" | sed 's/^/-S/' | sed ':a;N;$!ba;s/\n/ /g'`
43    PARAMS=" $DEVS $POOL1 $POOL2 $POOL3 -q --api-allow "W:0/0" --api-listen "
44
45    ntpd -d -n -q -N -p 0.openwrt.pool.ntp.org \
46        -p 1.openwrt.pool.ntp.org -p 2.openwrt.pool.ntp.org -p 3.openwrt.pool.ntp.org && \
47    start-stop-daemon -S -x $APP -p $PID_FILE -m -b -- $PARAMS
48}
49
50stop() {
51    start-stop-daemon -K -n $APP -p $PID_FILE -s TERM
52}
53

Archive Download this file



interactive