-
Notifications
You must be signed in to change notification settings - Fork 48
/
update.sh
52 lines (38 loc) · 1.44 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
cd /www/
echo "Install missing Linux packages"
apt-get install -y sysstat
apt-get install -y procps
echo "Install NPM dependencies"
npm install total4 2>/dev/null
npm install dbms 2>/dev/null
npm install pg 2>/dev/null
echo "Backing up old SuperAdmin: /www/superadmin_bk.zip"
zip -r superadmin_bk.zip superadmin 2>/dev/null
echo "Kills all running apps"
pkill -f total
mkdir superadmin_tmp
cp /www/superadmin/databases/applications.json /www/superadmin_tmp/applications.json
cp /www/superadmin/databases/stats.nosql /www/superadmin_tmp/stats.nosql
cp /www/superadmin/databases/acmethumbprint.txt /www/superadmin_tmp/acmethumbprint.txt
SA_PID=$(lsof -i :9999 | grep "LISTEN" | awk {'print $2'})
if [[ $SA_PID ]]
then
echo "Killing old instance of SuperAdmin"
kill -9 $SA_PID
fi
rm -rf /www/superadmin/
mkdir -p /www/superadmin/logs/
cd /www/superadmin/
echo "Downloading of new version of SuperAdmin"
wget "https://raw.githubusercontent.com/totaljs/superadmin_templates/main/superadmin.zip" 2>/dev/null
unzip superadmin.zip
rm superadmin.zip
cp /www/superadmin/nginx.conf /etc/nginx/nginx.conf
cp /www/superadmin/ffdhe2048.pem /etc/nginx/ffdhe2048.pem
mkdir databases
cp /www/superadmin_tmp/applications.json /www/superadmin/databases/applications.json
cp /www/superadmin_tmp/stats.nosql /www/superadmin/databases/stats.nosql
cp /www/superadmin_tmp/acmethumbprint.txt /www/superadmin/databases/acmethumbprint.txt
echo "Running..."
bash run.sh
echo "Done!"