-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathscript.sh
executable file
·58 lines (42 loc) · 1.52 KB
/
script.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
#!/bin/bash
docker-compose down -v
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
if [ "$#" -eq "0" ]
then
echo "No limit with the scrapper"
else
sed -i '' 's/.*reqs_authors = (grequests.get(link) for link in.*)/ reqs_authors = (grequests.get(link) for link in urls_author[:'"$1"'])/g' scraper/scraper.py
echo "Scrapping with limit" $1
fi
php_my_admin=phpmyadmin
nginx=webserver
mysql=db
app=app
scrap=scrap
echo "Launching Hackaton Banque de France"
docker-compose up -d $php_my_admin $nginx $mysql $app
echo "Waiting for all the containers to be up and running"
until [ "`docker inspect -f {{.State.Running}} $php_my_admin`"=="true" ] \
&& [ "`docker inspect -f {{.State.Running}} $nginx`"=="true" ] \
&& [ "`docker inspect -f {{.State.Running}} $mysql`"=="true" ] \
&& [ "`docker inspect -f {{.State.Running}} $app`"=="true" ]; do
sleep 0.1;
done;
echo "populate database"
docker-compose exec $app composer install
docker-compose exec $app php artisan migrate
echo "Run scrapper"
docker-compose up -d $scrap
until [ "`docker inspect -f {{.State.Running}} $scrap`"=="true" ]; do
sleep 0.1;
done;
docker exec -ti $(docker ps | grep scraper | cut -d " " -f 1) python ./scraper.py
if [ "$#" -eq "0" ]
then
echo "Almost done, wait ! without"
else
sed -i '' 's/.*reqs_authors = (grequests.get(link) for link in.*)/ reqs_authors = (grequests.get(link) for link in urls_author)/g' scraper/scraper.py
echo "Almost done, wait !"
fi
echo "Done"