-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall.sh
129 lines (122 loc) · 2.69 KB
/
install.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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
set -e
#检测是否是root用户
if [ $(id -u) != "0" ]; then
echo "错误:必须使用Root用户才能执行此脚本."
exit 1
fi
#包含文件
. mozhe.conf
. include/checkOS.sh
. include/firewall.sh
. include/lsyncd.sh
. include/nginx.sh
. include/pdns.sh
#. include/percona.sh
. include/mariadb.sh
. include/vhost.sh
#nginx配置
Function_vhost()
{
case "$1" in
[aA][dD][dD])
Add_host
;;
[sS][sS][lL])
Add_ssl_host
;;
[pP][dD][nN][sS])
Add_pdns_host
;;
*)
echo "用法: install.sh vhost {add|ssl|pdns}"
exit 1
;;
esac
}
#Lsyncd配置
Function_rsync()
{
case "$1" in
[kK][eE][yY])
Create_key 2>&1 /tmp/Create_key.log
;;
[iI][nN][sS][tT][aA][lL][lL])
Install_Lsyncd 2>&1 /tmp/Install_Lsyncd.log
;;
[cC][oO][pP][yY])
Sync_servers
;;
*)
echo "用法: install.sh rsync {key|install|sync}"
exit 1
;;
esac
}
#mysql配置
Function_mysql()
{
case "$1" in
[iI][nN][sS][tT][aA][lL][lL])
installMYSQLserver 2>&1 /tmp/installMYSQLserver.log
;;
[iI][nN][iI][tT])
initialGALERAserver 2>&1 /tmp/initialGALERAserver.log
;;
[nN][oO][dD][eE])
configNODEserver 2>&1 /tmp/configNODEserver.log
;;
*)
echo "用法: install.sh mysql {install|init|node}"
exit 1
;;
esac
}
#pdns配置
Function_pdns()
{
case "$1" in
[iI][nN][sS][tT][aA][lL][lL])
installMASTERpdns 2>&1 /tmp/Install_pdns.log
;;
[nN][oO][dD][eE])
installSLAVEpdns 2>&1 /tmp/initialPXC.log
;;
[aA][dD][mM][Ii][nN])
installPDNSadmin 2>&1 /tmp/installPDNSadmin.log
;;
*)
echo "用法: install.sh pdns {install|node|admin}"
exit 1
;;
esac
}
arg1=$1
arg2=$2
case ${arg1} in
[nN][gG][iI][nN][xX])
Install_nginx 2>&1 /tmp/Install_nginx.log
;;
[rR][sS][yY][nN][cC])
Function_rsync ${arg2}
;;
[mM][yY][sS][qQ][lL])
Function_mysql ${arg2}
;;
[pP][dD][nN][sS])
Function_pdns ${arg2}
;;
[vV][hH][oO][sS][tT])
Function_vhost ${arg2}
;;
*)
echo "用法: install.sh nginx"
echo "用法: install.sh rsync {key|install|sync}"
echo "用法: install.sh mysql {install|init|node}"
echo "用法: install.sh pdns {install|node|admin}"
echo "用法: install.sh vhost {add|ssl|pdns}"
exit 1
;;
esac