-
Notifications
You must be signed in to change notification settings - Fork 0
/
somexp.sh
89 lines (74 loc) · 2.61 KB
/
somexp.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/bin/bash
exists()
{
command -v "$1" >/dev/null 2>&1
}
if exists curl; then
echo ''
else
sudo apt update && sudo apt install curl -y < "/dev/null"
fi
bash_profile=$HOME/.bash_profile
if [ -f "$bash_profile" ]; then
. $HOME/.bash_profile
fi
cd $HOME
rm -rf subspace*
wget -O subspace-node https://github.com/subspace/subspace/releases/download/gemini-1b-2022-jun-10/subspace-node-ubuntu-x86_64-gemini-1b-2022-jun-10
wget -O subspace-farmer https://github.com/subspace/subspace/releases/download/gemini-1b-2022-jun-10/subspace-farmer-ubuntu-x86_64-gemini-1b-2022-jun-10
chmod +x subspace*
mv subspace* /usr/local/bin/
systemctl stop subspaced subspaced-farmer &>/dev/null
rm -rf ~/.local/share/subspace*
source ~/.bash_profile
sleep 1
echo "[Unit]
Description=Subspace Node
After=network.target
[Service]
User=$USER
Type=simple
ExecStart=$(which subspace-node) --chain gemini-1 --execution wasm --keep-blocks 1024 --pruning 1024 --validator --name $SUBSPACE_NODENAME
Restart=on-failure
RestartSec=10
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target" > $HOME/subspaced.service
echo "[Unit]
Description=Subspaced Farm
After=network.target
[Service]
User=$USER
Type=simple
ExecStart=$(which subspace-farmer) farm --reward-address $SUBSPACE_WALLET --plot-size $SUBSPACE_PLOT
Restart=on-failure
RestartSec=10
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target" > $HOME/subspaced-farmer.service
mv $HOME/subspaced* /etc/systemd/system/
sudo systemctl restart systemd-journald
sudo systemctl daemon-reload
sudo systemctl enable subspaced subspaced-farmer
sudo systemctl restart subspaced
sleep 10
sudo systemctl restart subspaced-farmer
echo "==================================================="
echo -e '\n\e[42mCheck node status\e[0m\n' && sleep 1
if [[ `service subspaced status | grep active` =~ "running" ]]; then
echo -e "Your Subspace node \e[32minstalled and works\e[39m!"
echo -e "You can check node status by the command \e[7mservice subspaced status\e[0m"
echo -e "Press \e[7mQ\e[0m for exit from status menu"
else
echo -e "Your Subspace node \e[31mwas not installed correctly\e[39m, please reinstall."
fi
sleep 2
echo "==================================================="
echo -e '\n\e[42mCheck farmer status\e[0m\n' && sleep 1
if [[ `service subspaced-farmer status | grep active` =~ "running" ]]; then
echo -e "Your Subspace farmer \e[32minstalled and works\e[39m!"
echo -e "You can check node status by the command \e[7mservice subspaced-farmer status\e[0m"
echo -e "Press \e[7mQ\e[0m for exit from status menu"
else
echo -e "Your Subspace farmer \e[31mwas not installed correctly\e[39m, please reinstall."
fi