update checkos function
This commit is contained in:
parent
e17c947554
commit
39bbe20a54
18
haproxy.sh
18
haproxy.sh
|
|
@ -25,12 +25,20 @@ rootness(){
|
||||||
}
|
}
|
||||||
|
|
||||||
checkos(){
|
checkos(){
|
||||||
if [ -f /etc/redhat-release ];then
|
if [[ -f /etc/redhat-release ]];then
|
||||||
OS=CentOS
|
OS=CentOS
|
||||||
elif [ ! -z "`cat /etc/issue | grep bian`" ];then
|
elif cat /etc/issue | grep -q -E -i "debian";then
|
||||||
OS=Debian
|
OS=Debian
|
||||||
elif [ ! -z "`cat /etc/issue | grep Ubuntu`" ];then
|
elif cat /etc/issue | grep -q -E -i "ubuntu";then
|
||||||
OS=Ubuntu
|
OS=Ubuntu
|
||||||
|
elif cat /etc/issue | grep -q -E -i "centos|red hat|redhat";then
|
||||||
|
OS=CentOS
|
||||||
|
elif cat /proc/version | grep -q -E -i "debian";then
|
||||||
|
OS=Debian
|
||||||
|
elif cat /proc/version | grep -q -E -i "ubuntu";then
|
||||||
|
OS=Ubuntu
|
||||||
|
elif cat /proc/version | grep -q -E -i "centos|red hat|redhat";then
|
||||||
|
OS=CentOS
|
||||||
else
|
else
|
||||||
echo "Not supported OS, Please reinstall OS and try again."
|
echo "Not supported OS, Please reinstall OS and try again."
|
||||||
exit 1
|
exit 1
|
||||||
|
|
@ -165,7 +173,7 @@ EOF
|
||||||
|
|
||||||
install(){
|
install(){
|
||||||
# Install haproxy
|
# Install haproxy
|
||||||
if [ "$OS" == 'CentOS' ];then
|
if [ "${OS}" == 'CentOS' ];then
|
||||||
yum install -y haproxy
|
yum install -y haproxy
|
||||||
else
|
else
|
||||||
apt-get -y update
|
apt-get -y update
|
||||||
|
|
@ -179,7 +187,7 @@ install(){
|
||||||
config_haproxy
|
config_haproxy
|
||||||
echo "Config haproxy completed..."
|
echo "Config haproxy completed..."
|
||||||
|
|
||||||
if [ "$OS" == 'CentOS' ]; then
|
if [ "${OS}" == 'CentOS' ]; then
|
||||||
chkconfig --add haproxy
|
chkconfig --add haproxy
|
||||||
chkconfig haproxy on
|
chkconfig haproxy on
|
||||||
else
|
else
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user