-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsetup.sh
executable file
·51 lines (39 loc) · 1.23 KB
/
setup.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
#!/bin/sh
Green="\e[32m"
Red="\033[0;31m"
NC='\033[0m'
if [ "$1" = "stop" ]; then
echo "${Red}Stopping API containers and closing all pipelines${NC}"
sudo docker compose down --rmi local
pkill -f ./log.sh
pkill -f watch
echo "${Red}clearing log files for fresh start${NC}\n"
truncate -s 0 ./log/nginx.log
truncate -s 0 ./log/filter.log
exit 0
fi
if [ "$(stat -c %A run.sh | sed 's/...\(.\).\+/\1/')" = "x" ]; then
echo "${Green}Owner has execute permission for run.sh${NC}"
else
echo "${Red}Adding execute permission to run.sh${NC}"
chmod +x run.sh
fi
if [ "$(stat -c %A log.sh | sed 's/...\(.\).\+/\1/')" = "x" ]; then
echo "${Green}Owner has execute permission for log.sh${NC}"
else
echo "${Red}Adding execute permission to log.sh${NC}"
chmod +x log.sh
fi
if [ "$(stat -c %A ./log/filter.sh | sed 's/...\(.\).\+/\1/')" = "x" ]; then
echo "${Green}Owner has execute permission for filter.sh${NC}"
else
echo "${Red}Adding execute permission to filter.sh${NC}"
chmod +x ./log/filter.sh
fi
./run.sh
./log.sh &
cd ./log || exit; watch -tn1 ./filter.sh nginx.log &
cd ../pipe || exit; watch -tn5 ./copy.sh &
cd ../guard || exit; watch -tn5 ./answer.sh &
cd ../ || exit; watch -tn5 ./sol.sh &
reset