forked from spesmilo/swap-server-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
migrate_swaps
executable file
·64 lines (41 loc) · 1.13 KB
/
migrate_swaps
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
#!/bin/bash
NET="$1"
COMMAND="$2"
usage="usage: $0 (testnet|mainnet) (migrate|cleanup|deploy)"
if [ "$NET" == "testnet" ]; then
LNCLI=$TESTNET_LNCLI
BOLTZCLI=$TESTNET_BOLTZCLI
elif [ "$NET" == "mainnet" ]; then
LNCLI=$MAINNET_LNCLI
BOLTZCLI=$MAINNET_BOLTZCLI
else
echo $usage
exit 0
fi
cd
lnd_data_tgz="lnd_data.$NET.tgz"
boltz_data_tgz="boltz_data.$NET.tgz"
if [ "$COMMAND" == "migrate" ]; then
# test access
ssh migration_server echo "hello"
echo "stopping lnd"
./scripts/stop_lnd $NET
./scripts/stop_boltzd $NET
tar -czf $lnd_data_tgz --exclude="$NET/lnd/logs" $NET/lnd
tar -czf $boltz_data_tgz $NET/boltz
scp $lnd_data_tgz boltz@migration_server:
scp $boltz_data_tgz boltz@migration_server:
elif [ "$COMMAND" == "cleanup" ]; then
echo "post-migration cleanup:"
echo "rm -rf $NET/lnd"
echo "rm -rf $NET/boltz"
elif [ "$COMMAND" == "deploy" ]; then
tar -xvzf $lnd_data_tgz
tar -xvzf $boltz_data_tgz
echo "manually start lnd and boltzd"
#./scripts/start_lnd $NET
#./scripts/start_boltzd $NET
else
echo $usage
exit 1
fi