forked from mistio/mist-ce
-
Notifications
You must be signed in to change notification settings - Fork 0
/
restart.sh
executable file
·35 lines (35 loc) · 1.42 KB
/
restart.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
#!/bin/sh
if [ $# -eq 0 ]; then
echo "Reloading api & dramatiq"
echo "---------------------------------------------------"
docker compose exec api sh -c "kill -HUP 1"
echo "api-v1 \tDone"
docker compose exec api-v2 sh -c "kill -HUP 1"
echo "api-v2 \tDone"
docker compose exec dramatiq bash -c 'kill -HUP $(ps aux | grep -e python | awk "{ print \$2 }")'
echo "dramatiq \tDone"
echo "Done."
elif [ $# -eq 1 ] && [ "$@" = "all" ]; then
echo "Restarting all containers that import mist.api code"
echo "---------------------------------------------------"
docker compose restart api api-v2 dramatiq sockjs scheduler
echo "Done."
elif [ $# -eq 1 ] && [ "$@" = "api" ]; then
echo "Sending HUP signal to uwsgi"
echo "---------------------------------------------------"
docker compose exec api sh -c "kill -HUP 1"
echo "api-v1 \tDone"
docker compose exec api-v2 sh -c "kill -HUP 1"
echo "api-v2 \tDone"
echo "---------------------------------------------------"
elif [ $# -eq 1 ] && [ "$@" = "dramatiq" ]; then
echo "Sending HUP signal to dramatiq"
echo "---------------------------------------------------"
docker compose exec dramatiq bash -c 'kill -HUP $(ps aux | grep -e python | awk "{ print \$2 }")'
echo "Done"
else
echo "Restarting $@"
echo "---------------------------------------------------"
docker compose restart $@
echo "Done"
fi;