#!/bin/bash
func1()
{
yum -y install httpd
systemctl start httpd
func1()
{
yum -y install httpd
systemctl start httpd
systemctl enable httpd
}
func2()
{
apt-get -y install nginx
/etc/init.d/nginx start
}
func2()
{
apt-get -y install nginx
/etc/init.d/nginx start
update-rc.d nginx defaults
}file1="/etc/redhat-release"
file2="/etc/lsb-release"
if [ -f "$file1" ]
then
echo "Centos box"
cat /etc/redhat-release | grep -i 'Centos' | awk '{if(NR==2) print $0}'; echo $?
func1
elif [ -f "$file2" ]
then echo " Ubuntu Box "
cat /etc/lsb-release | grep -i 'Ubuntu' | awk '{if(NR==2) print $0}'; echo $?
func2
else
echo "desired OS flavor not found"
fi
No comments:
Post a Comment