-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path11-functions.sh
More file actions
51 lines (45 loc) · 1023 Bytes
/
11-functions.sh
File metadata and controls
51 lines (45 loc) · 1023 Bytes
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
#!/bin/bash
USERID=$(id -u)
if [ $USERID -ne 0 ]
then
echo "ERROR:: Please run this script with root access"
exit 1 #give other than 0 upto 127
else
echo "You are running with root access"
fi
VALIDATE(){
if [ $1 -eq 0 ]
then
echo "Installing $2 is ... SUCCESS"
else
echo "Installing $2 is ... FAILURE"
exit 1
fi
}
dnf list installed mysql
if [ $? -ne 0 ]
then
echo "MySQL is not installed... going to install it"
dnf install mysql -y
VALIDATE $? "MySQL"
else
echo "MySQL is already installed...Nothing to do"
fi
dnf list installed python3
if [ $? -ne 0 ]
then
echo "python3 is not installed... going to install it"
dnf install python3 -y
VALIDATE $? "python3"
else
echo "python3 is already installed...Nothing to do"
fi
dnf list installed nginx
if [ $? -ne 0 ]
then
echo "nginx is not installed... going to install it"
dnf install nginx -y
VALIDATE $? "nginx"
else
echo "nginx is already installed...Nothing to do"
fi