forked from RunOnFlux/fluxnode-multitool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
multinode.sh
52 lines (46 loc) · 1.47 KB
/
multinode.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
#!/bin/bash
source /dev/stdin <<< "$(curl -s https://raw.githubusercontent.com/RunOnFlux/fluxnode-multitool/${ROOT_BRANCH}/flux_common.sh)"
function upnp_disable() {
if [[ ! -f /home/$USER/zelflux/config/userconfig.js ]]; then
echo -e "${WORNING} ${CYAN}Missing FluxOS configuration file - install/re-install Flux Node...${NC}"
echo -e ""
exit
fi
if [[ -f /home/$USER/.fluxbenchmark/fluxbench.conf ]]; then
if [[ $(grep -e "fluxport" /home/$USER/.fluxbenchmark/fluxbench.conf) != "" ]]; then
echo -e ""
echo -e "${ARROW} ${YELLOW}Removing FluxOS UPnP configuration.....${NC}"
sed -i "/$(grep -e "fluxport" /home/$USER/.fluxbenchmark/fluxbench.conf)/d" /home/$USER/.fluxbenchmark/fluxbench.conf > /dev/null 2>&1
else
echo -e "${ARROW} ${CYAN}UPnP Mode is already disabled...${NC}"
echo -e ""
exit
fi
else
echo -e "${ARROW} ${CYAN}UPnP Mode is already disabled...${NC}"
echo -e ""
exit
fi
if [[ $(cat /home/$USER/zelflux/config/userconfig.js | grep 'apiport' | wc -l) == "1" ]]; then
RemoveLine "routerIP"
RemoveLine "apiport"
fi
echo -e "${ARROW} ${CYAN}Restarting FluxOS and Benchmark.....${NC}"
echo -e ""
sudo systemctl restart zelcash > /dev/null 2>&1
pm2 restart flux > /dev/null 2>&1
sleep 10
}
CHOICE=$(
whiptail --title "UPnP Configuration" --menu "Make your choice" 16 30 9 \
"1)" "Enable UPnP Mode" \
"2)" "Disable UPnP Mode" 3>&2 2>&1 1>&3
)
case $CHOICE in
"1)")
upnp_enable
;;
"2)")
upnp_disable
;;
esac