forked from solusvm-support/helpers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
svmupgradestack.sh
97 lines (75 loc) · 2.98 KB
/
svmupgradestack.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
90
91
92
93
94
95
96
97
#!/bin/bash
# This is script to upgrade SolusVM node to svmstack - svmstack-nginx and PHP 5.6.30
# kb article 360022824452
set -uo pipefail
function menu() {
clear
echo " o----------------------------------------------------------------o";
echo " | |";
echo " | Is the current server Master or Slave node? |";
echo " | |";
echo " | |";
echo " | ---------------------------------------------------------- |";
echo " | | Type | Option |";
echo " | ========================================================== |";
echo " | | SolusVM Master | [1] |";
echo " | ---------------------------------------------------------- |";
echo " | | SolusVM Slave | [2] |";
echo " | ---------------------------------------------------------- |";
echo " | |";
echo " o----------------------------------------------------------------o";
echo ""
echo " Choose an option : ";
read -r option;
until [ "${option}" == "1" ] || [ "${option}" == "2" ]; do
echo " Please enter a valid option: ";
read -r option;
done
if [ "${option}" == "1" ]; then
upgradeMaster;
elif [ "${option}" == "2" ]; then
upgradeSlave;
fi
}
function upgradeMaster () {
echo "Stopping and disabling lighttpd..."
service lighttpd stop
chkconfig lighttpd off
echo "Installing the latest solusvm-release..."
yum install solusvm-release -y
echo "Updating PHP..."
yum update svmstack-php -y
mv /usr/bin/php /usr/bin/backup-php
ln -s /usr/local/svmstack/php/bin/php /usr/bin/php
echo "Installing svmstack-nginx..."
yum install svmstack-nginx svmstack-nginx-legacy-master-config -y
echo "Starting services..."
chkconfig svmstack-nginx on
chkconfig svmstack-fpm on
service svmstack-nginx restart
service svmstack-fpm restart
echo "Upgrade to svmstack-nginx and PHP 5.6.30 is completed!"
}
function upgradeSlave () {
echo "Stopping and disabling lighttpd..."
service lighttpd stop
chkconfig lighttpd off
echo "Installing the latest solusvm-release..."
yum install solusvm-release -y
echo "Updating PHP..."
yum update svmstack-php -y
mv /usr/bin/php /usr/bin/backup-php
ln -s /usr/local/svmstack/php/bin/php /usr/bin/php
echo "Installing svmstack-nginx..."
yum install svmstack-nginx svmstack-nginx-legacy-slave-config -y
echo "Starting services..."
chkconfig svmstack-nginx on
chkconfig svmstack-fpm on
service svmstack-nginx restart
service svmstack-fpm restart
echo "Upgrade to svmstack-nginx and PHP 5.6.30 is completed!"
}
function main () {
menu
}
main "$@"