-
Notifications
You must be signed in to change notification settings - Fork 0
/
web.sh
41 lines (41 loc) · 1.12 KB
/
web.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
#!/bin/bash
R="\e[31m"
G="\e[32m"
Y="\e[33m"
N="\e[0m"
TIMESTAMP=$(date +%F-%H-%M-%S)
LOGFILE=/tmp/$0-$TIMESTAMP.log
ID=$(id -u)
if [ $ID -ne 0 ]
then echo -e "your not authorized to install"
exit 1
else echo -e "your a root user"
fi
VALIDATE(){
if [ $1 -eq 0 ]
then
echo -e "$G $2 $N"
else
echo -e "$R Please check there is some issues $N"
exit 1
fi
}
dnf install nginx -y &>> $LOGFILE
VALIDATE $? "nginx installed"
systemctl enable nginx &>> $LOGFILE
VALIDATE $? "nginx enabled"
systemctl start nginx &>> $LOGFILE
VALIDATE $? "nginx started"
rm -rf /usr/share/nginx/html/* &>> $LOGFILE
VALIDATE $? "removed default content in html"
curl -o /tmp/web.zip https://roboshop-builds.s3.amazonaws.com/web.zip &>> $LOGFILE
VALIDATE $? "downloaded web content in zip"
cd /usr/share/nginx/html &>> $LOGFILE
VALIDATE $? "change directory to /usr/share/nginx/html"
unzip /tmp/web.zip &>> $LOGFILE
VALIDATE $? "unzip web content"
cp /root/roboshop-shell/roboshop.conf /etc/nginx/default.d/roboshop.conf &>> $LOGFILE
VALIDATE $? "copied roboshop.conf file to /etc"
systemctl restart nginx &>> $LOGFILE
VALIDATE $? "nginx restarted"
systemctl status nginx