1
0
mirror of git://projects.qi-hardware.com/openwrt-packages.git synced 2024-11-26 15:50:36 +02:00
openwrt-packages/cgminer/files/cgminer.init

53 lines
1.4 KiB
Plaintext
Raw Normal View History

#!/bin/sh /etc/rc.common
START=99
2013-03-02 11:24:35 +02:00
APP=cgminer
PID_FILE=/var/run/$APP.pid
start() {
2013-03-02 11:24:35 +02:00
local _pool1url
local _pool1user
local _pool1pw
local _pool2url
local _pool2user
local _pool2pw
local _pool3url
local _pool3user
local _pool3pw
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
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
DEVS=`find /dev/ -type c -name "ttyUSB*" | sed 's/^/-S/' | sed ':a;N;$!ba;s/\n/ /g'`
2013-03-02 11:24:35 +02:00
PARAMS=" $DEVS $POOL1 $POOL2 $POOL3 -q --api-allow "W:0/0" --api-listen "
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 && \
2013-03-02 11:24:35 +02:00
start-stop-daemon -S -x $APP -p $PID_FILE -m -b -- $PARAMS
}
stop() {
2013-03-02 11:24:35 +02:00
start-stop-daemon -K -n $APP -p $PID_FILE -s TERM
}