-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstop-automl.sh
More file actions
executable file
·51 lines (40 loc) · 1.37 KB
/
Copy pathstop-automl.sh
File metadata and controls
executable file
·51 lines (40 loc) · 1.37 KB
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/bash
# function to check if a specific service exists in the os
service_exists() {
local n=$1
if [[ $(systemctl list-units --all -t service --full --no-legend "$n.service" | sed 's/^\s*//g' | cut -f1 -d' ') == $n.service ]]; then
return 0
else
return 1
fi
}
# code for optional bash parameter --remove-container
REMOVE_CONTAINERS=false
while [ "$1" ]; do
case $1 in
--remove-containers) REMOVE_CONTAINERS=true ;;
*) echo 'Error in command line parsing' >&2
exit 1
esac
shift
done
# color codes for better output formatting
GREEN='\033[0;32m' # green color
NC='\033[0m' # No Color
# check if docker exists, and if yes, use it to stop the app
if service_exists docker; then
# stop app by shutting down the container
echo -e "${GREEN}Shutting down AutoML...${NC}"
docker stop automl
if "$REMOVE_CONTAINERS"; then
echo -e "${GREEN}Removing docker container and images...${NC}"
docker rm automl # remove kafka container
docker image rm automl:latest # remove automl image
docker volume prune -f # remove unused volumes
fi
else
# if docker does not exist, kill the streamlit process
echo -e "${GREEN}Shutting down AutoML...${NC}"
kill `pgrep streamlit`
fi
echo -e "${GREEN}AutoML app was successfully shutted down!${NC}"