-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathupdate.sh
73 lines (56 loc) · 1.97 KB
/
update.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
#!/bin/bash
# Set variables
# -----------------------------------
GUNBOT_GITHUB_FOLDER_NAME="Gunbot3.3.2"
GUNBOT_GITHUB_FILE_NAME="GUNBOT_v3.3.2_Poloniex_Bittrex_Patch"
TIMESTAMP="$(date +"%s")"
LATEST_PATCH="v3.3.2 Poloniex Bittrex"
# Set functions
# -----------------------------------
logMessage () {
echo " $1"
echo " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
}
echo ""
echo " ============================================================"
echo " GUNBOT 3.3.2 UPDATE started"
echo ""
echo " Patch ${LATEST_PATCH}"
echo ""
echo " ============================================================"
echo ""
logMessage "(1/4) Stop all bots"
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pm2 stop all > /dev/null 2>&1
logMessage "(2/4) Backup current version"
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cp /opt/gunbot/ /opt/gunbot-backup-${TIMESTAMP}/ -r > /dev/null 2>&1
logMessage "(3/4) Update tools"
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
npm install -g generator-gunbot > /dev/null 2>&1
logMessage "(4/4) Update GUNBOT"
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Install latest release as patch
wget -q https://github.com/GuntharDeNiro/BTCT/releases/download/${GUNBOT_GITHUB_FOLDER_NAME}/${GUNBOT_GITHUB_FILE_NAME}.zip -P /opt/
unzip -o -qq /opt/${GUNBOT_GITHUB_FILE_NAME}.zip -d /opt/unzip-tmp
# Remove all executables.
rm -f /opt/gunbot/gunthy-*
# Copy only the executables.
cp /opt/unzip-tmp/gunthy-* /opt/gunbot
# Cleanup
rm /opt/${GUNBOT_GITHUB_FILE_NAME}.zip
rm -Rf /opt/unzip-tmp
# Set rights
chmod +x /opt/gunbot/gunthy-*
echo ""
echo " ============================================================"
echo " GUNBOT UPDATE complete!"
echo ""
echo " Please run this command to restart the GUNBOT:"
echo " gcd"
echo " ginit"
echo ""
echo " (allow overwrite of ALLPAIRS)"
echo ""
echo " ============================================================"
echo ""