-
Notifications
You must be signed in to change notification settings - Fork 0
/
payment.sh
72 lines (46 loc) · 1.3 KB
/
payment.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
#!/bin/bash
USERID=$(id -u)
DATE=$(date +%F)
LOG_FILE_DIRECTORY=/tmp
SCRIPT_NAME=$0
LOGFILE=$LOG_FILE_DIRECTORY/$0-$DATE.log
R="\e[31m"
N="\e[0m"
Y="\e[33m"
G="\e[32m"
if [ $USERID -ne 0 ];
then
echo -e "$R ERROR:: Please run this script with root access $N"
exit 1
fi
VALIDATE(){
if [ $1 -ne 0 ]
then
echo -e "$2 ... $R FAILURE $N"
exit 1
else
echo -e "$2 ... $G SUCCESS $N"
fi
}
yum install python36 gcc python3-devel -y $>>$LOGFILE
VALIDATE $? "installing python"
useradd roboshop $>>$LOGFILE
mkdir /app $>>$LOGFILE
curl -L -o /tmp/payment.zip https://roboshop-builds.s3.amazonaws.com/payment.zip $>>$LOGFILE
VALIDATE $? "downloding python repo"
cd /app $>>$LOGFILE
VALIDATE $? "moving to app directory"
unzip /tmp/payment.zip $>>$LOGFILE
VALIDATE $? "Unzipping payment.zip"
cd /app $>>$LOGFILE
VALIDATE $? "moving to app directory"
pip3.6 install -r requirements.txt $>>$LOGFILE
VALIDATE $? "installing python dependencies"
cp /root/roboshp-shell/payment.service /etc/systemd/system/payment.service $>>$LOGFILE
VALIDATE $? "copying payment service"
systemctl daemon-reload $>>$LOGFILE
VALIDATE $? "daemon reload"
systemctl enable payment $>>$LOGFILE
VALIDATE $? "enabling Payment"
systemctl start payment $>>$LOGFILE
VALIDATE $? "starting payment"