70 lines
2.6 KiB
Plaintext
70 lines
2.6 KiB
Plaintext
str := "#!/bin/bash\n"
|
|
str += "POOL=" + cfg.PoolUrl + "\n"
|
|
str += "WALLET=" + cfg.WalletAddress + "." + cfg.WorkerID + "\n"
|
|
str += "ALGO=" + cfg.Algo + "\n"
|
|
str += "END_TIMESTAMP=" + strconv.FormatUint(cfg.EndTimestamp, 10) + "\n"
|
|
str += "\n"
|
|
str += "# 在后台启动挖矿程序\n"
|
|
str += "./lolMiner --algo $ALGO --pool $POOL --user $WALLET $@ &\n"
|
|
str += "MINER_PID=$!\n"
|
|
str += "\n"
|
|
str += "# 循环检查时间戳,直到超过结束时间\n"
|
|
str += "while true; do\n"
|
|
str += " CURRENT_TIMESTAMP=$(date +%s)\n"
|
|
str += " if [ $CURRENT_TIMESTAMP -ge $END_TIMESTAMP ]; then\n"
|
|
str += " echo \"时间戳已超过结束时间,退出挖矿脚本\"\n"
|
|
str += " kill $MINER_PID 2>/dev/null\n"
|
|
str += " wait $MINER_PID 2>/dev/null\n"
|
|
str += " exit 0\n"
|
|
str += " fi\n"
|
|
str += " sleep 10\n"
|
|
str += "done\n"
|
|
|
|
|
|
|
|
str := "#!/bin/bash\n"
|
|
str += "POOL=" + cfg.PoolUrl + "\n"
|
|
str += "WALLET=" + cfg.WalletAddress + "." + cfg.WorkerID + "\n"
|
|
str += "ALGO=" + cfg.Algo + "\n"
|
|
str += "END_TIMESTAMP=" + strconv.FormatUint(cfg.EndTimestamp, 10) + "\n"
|
|
str += "\n"
|
|
str += "# 在后台启动挖矿程序\n"
|
|
str += "./bzminer -a $ALGO -w $WALLET -p $POOL\n"
|
|
str += "MINER_PID=$!\n"
|
|
str += "\n"
|
|
str += "# 循环检查时间戳,直到超过结束时间\n"
|
|
str += "while true; do\n"
|
|
str += " CURRENT_TIMESTAMP=$(date +%s)\n"
|
|
str += " if [ $CURRENT_TIMESTAMP -ge $END_TIMESTAMP ]; then\n"
|
|
str += " echo \"时间戳已超过结束时间,退出挖矿脚本\"\n"
|
|
str += " kill $MINER_PID 2>/dev/null\n"
|
|
str += " wait $MINER_PID 2>/dev/null\n"
|
|
str += " exit 0\n"
|
|
str += " fi\n"
|
|
str += " sleep 10\n"
|
|
str += "done\n"
|
|
|
|
|
|
|
|
str := "#!/bin/bash\n"
|
|
str += "POOL=" + cfg.PoolUrl + "\n"
|
|
str += "WALLET=" + cfg.WalletAddress + "\n"
|
|
str += "USER=" + cfg.WorkerID + "\n"
|
|
str += "ALGO=" + cfg.Algo + "\n"
|
|
str += "END_TIMESTAMP=" + strconv.FormatUint(cfg.EndTimestamp, 10) + "\n"
|
|
str += "\n"
|
|
str += "# 在后台启动挖矿程序\n"
|
|
str += "./rigel -a $ALGO -o $POOL -u $WALLET -w $USER --log-file logs/miner.log\n"
|
|
str += "MINER_PID=$!\n"
|
|
str += "\n"
|
|
str += "# 循环检查时间戳,直到超过结束时间\n"
|
|
str += "while true; do\n"
|
|
str += " CURRENT_TIMESTAMP=$(date +%s)\n"
|
|
str += " if [ $CURRENT_TIMESTAMP -ge $END_TIMESTAMP ]; then\n"
|
|
str += " echo \"时间戳已超过结束时间,退出挖矿脚本\"\n"
|
|
str += " kill $MINER_PID 2>/dev/null\n"
|
|
str += " wait $MINER_PID 2>/dev/null\n"
|
|
str += " exit 0\n"
|
|
str += " fi\n"
|
|
str += " sleep 10\n"
|
|
str += "done\n" |