-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrypoint.sh
57 lines (46 loc) · 1.82 KB
/
entrypoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/sh
set -e
# ==============================================================================
# COLORS VARIABLES
# ==============================================================================
GREEN="\\033[0;92m"
YELLOW="\\033[0;93m"
PURPLE="\\033[0;95m"
CYAN="\\033[0;96m"
NC="\\033[0;97m"
# ==============================================================================
# MINING VARIABLES
# ==============================================================================
CPU_LIMIT_ENABLE="${CPU_LIMIT_ENABLE:-true}"
CPU_LIMIT_PERCENT="${CPU_LIMIT_PERCENT:-100}"
CPU_LIMIT=$(($(nproc) * $CPU_LIMIT_PERCENT))
POOL="${MINING_POOL:-rx.unmineable.com:3333}"
COIN="${COIN:-SHIB}"
REFERRAL_CODE="${REFERRAL_CODE:-18ps-7t5s}"
WALLET_ADDRESS="${WALLET_ADDRESS:-0xb3FEb8873EBE00FA21c7A08F4688d8402487799E}"
WORKER_NAME="${WORKER_NAME:-dockerworker}"
XMRIG_CONFIG_FILE="/usr/src/mining/config/xmrig.json"
# ==============================================================================
# FUNCTIONS
# ==============================================================================
Status() {
echo -e "${CYAN}[INFO]${NC}: $1"
}
sed -i "s/POOL/$POOL/g" "$XMRIG_CONFIG_FILE"
sed -i "s/COIN/$COIN/g" "$XMRIG_CONFIG_FILE"
sed -i "s/WALLET_ADDRESS/$WALLET_ADDRESS/g" "$XMRIG_CONFIG_FILE"
sed -i "s/WORKER_NAME/$WORKER_NAME/g" "$XMRIG_CONFIG_FILE"
sed -i "s/REFERRAL_CODE/$REFERRAL_CODE/g" "$XMRIG_CONFIG_FILE"
if [[ "$MINING_AUTO_CONFIG" == "true" ]]; then
Status "Starting miner with config..."
xmrig -c "$XMRIG_CONFIG_FILE" $@ & sleep 5
else
Status "Starting miner with cli parameters..."
xmrig -o "$POOL" -a rx -k -u "$COIN:$WALLET_ADDRESS.$WORKER_NAME#$REFERRAL_CODE" -p x & sleep 5
fi
if [[ "$CPU_LIMIT_ENABLE" == "true" ]]; then
Status "Enable CPU Limit..."
cpulimit -l $CPU_LIMIT -p $(pidof xmrig) -z
else
Status "Disable CPU Limit..."
fi