-
Notifications
You must be signed in to change notification settings - Fork 4
/
start-lnd.sh
69 lines (63 loc) · 1.67 KB
/
start-lnd.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
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/bash
SERVICE_NAME="lnd-service"
SERVICE_PATH="lnd --trickledelay=5000 \
--debuglevel=debug \
--alias=mar-uxuy-lnd \
--rpclisten=0.0.0.0:10009 \
--listen=0.0.0.0:9735 \
--bitcoin.node=neutrino \
--bitcoin.active \
--bitcoin.mainnet \
--neutrino.addpeer=mainnet2-btcd.zaphq.io \
--neutrino.addpeer=mainnet1-btcd.zaphq.io \
--neutrino.addpeer=btcd-mainnet.lightning.computer \
--neutrino.addpeer=mainnet1-btcd.zaphq.io \
--neutrino.addpeer=mainnet2-btcd.zaphq.io \
--neutrino.addpeer=mainnet3-btcd.zaphq.io \
--neutrino.addpeer=mainnet4-btcd.zaphq.io \
--neutrino.addpeer=faucet.lightning.community \
--feeurl=https://nodes.lightning.computer/fees/v1/btc-fee-estimates.json
"
PID_FILE="/root/$SERVICE_NAME.pid"
LOG_FILE="/root/$SERVICE_NAME.log"
start_service() {
if [ -f "$PID_FILE" ]; then
echo "$SERVICE_NAME is already running."
else
echo "Starting $SERVICE_NAME..."
$SERVICE_PATH >> "$LOG_FILE" 2>&1 &
echo $! > "$PID_FILE"
echo "$SERVICE_NAME is now running with PID $!"
fi
}
stop_service() {
if [ -f "$PID_FILE" ]; then
echo "Stopping $SERVICE_NAME..."
PID=$(cat "$PID_FILE")
kill "$PID"
rm "$PID_FILE"
echo "$SERVICE_NAME has been stopped."
else
echo "$SERVICE_NAME is not running."
fi
}
restart_service() {
stop_service
start_service
}
case "$1" in
start)
start_service
;;
stop)
stop_service
;;
restart)
restart_service
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
;;
esac
exit 0