-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMNUpdateWithAutoRestart
More file actions
49 lines (39 loc) · 1.18 KB
/
Copy pathMNUpdateWithAutoRestart
File metadata and controls
49 lines (39 loc) · 1.18 KB
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
#!/bin/bash
#prepare MN for updating by stopping wagerrd and removing wagerr-2.0.0
cd ~/wagerr-2.0.0/bin
./wagerr-cli stop
cd ~
rm -r ~/wagerr-2.0.0
#download, unzip, and remove tar.gz for new new release
wget -q https://github.com/wagerr/wagerr/releases/download/v2.0.1/wagerr-2.0.1-x86_64-linux-gnu.tar.gz
tar -xvf wagerr-2.0.1-x86_64-linux-gnu.tar.gz
rm wagerr-2.0.1-x86_64-linux-gnu.tar.gz
#start wagerrd
cd ~/wagerr-2.0.1/bin
./wagerrd &
echo -e "Your Wagerr Masternode has been successfully upgraded to version 2.0.1 Monte Carlo"
#start of Auto-Restart script creation
read -p "Do you want to create the mn_auto script? (Y/n) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
cd ~/wagerr-2.0.1/bin
cat <<EOT > mn_auto.sh
#!/bin/bash
SERVICE='wagerrd'
if ps ax | grep -v grep | grep $SERVICE > /dev/null
then
echo “Masternode is running! Yay!”
else
~/wagerr-2.0.1/bin/./wagerrd
fi
EOT
chmod 744 mn_auto.sh
fi
read -p "Do you want to add the required cron task? (Y/n) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
crontab -l | { cat; echo "*/15 * * * * /root/wagerr-2.0.1/bin/mn_auto.sh >> /root/wagerr-2.0.1/bin/cronlog/auto.log 2>&1 #logs output to auto.log"; } | crontab - l
mkdir cronlog
fi