-
Notifications
You must be signed in to change notification settings - Fork 411
/
check-init.sh
72 lines (65 loc) · 2.92 KB
/
check-init.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
66
67
68
69
70
71
72
#!/bin/bash
#
# This script verifies if SecDevLabs app has properly start-up.
#
COLOR_RED='\033[31m'
COLOR_YELLOW='\033[33m'
COLOR_GREEN='\033[32m'
COLOR_BLUE='\033[1;34m'
COLOR_RESET='\033[0m'
PROJECT= # Your app's name here!
PORT= # Your app's port here!
TRIES=480
LOADING=0
printf "${COLOR_YELLOW}SecDevLabs: 👀 Your app is starting!\n${COLOR_RESET}"
while : ; do
`curl -s -f http://localhost:$PORT > /dev/null`
if [ $? == 0 ] ; then
break
fi
if [ $TRIES == 0 ] ; then
break
fi
TRIES=$((TRIES-1))
sleep 0.25
# Loading animation
if [ $LOADING == 14 ]; then
LOADING=0
fi
if [ $LOADING == 0 ]; then
printf "\r${COLOR_YELLOW}SecDevLabs: 👀 Your app is still starting... (*-------) ${COLOR_RESET}"
elif [ $LOADING == 1 ]; then
printf "\r${COLOR_YELLOW}SecDevLabs: 👀 Your app is still starting... (-*------) ${COLOR_RESET}"
elif [ $LOADING == 2 ]; then
printf "\r${COLOR_YELLOW}SecDevLabs: 👀 Your app is still starting... (--*-----) ${COLOR_RESET}"
elif [ $LOADING == 3 ]; then
printf "\r${COLOR_YELLOW}SecDevLabs: 👀 Your app is still starting... (---*----) ${COLOR_RESET}"
elif [ $LOADING == 4 ]; then
printf "\r${COLOR_YELLOW}SecDevLabs: 👀 Your app is still starting... (----*---) ${COLOR_RESET}"
elif [ $LOADING == 5 ]; then
printf "\r${COLOR_YELLOW}SecDevLabs: 👀 Your app is still starting... (-----*--) ${COLOR_RESET}"
elif [ $LOADING == 6 ]; then
printf "\r${COLOR_YELLOW}SecDevLabs: 👀 Your app is still starting... (------*-) ${COLOR_RESET}"
elif [ $LOADING == 7 ]; then
printf "\r${COLOR_YELLOW}SecDevLabs: 👀 Your app is still starting... (-------*) ${COLOR_RESET}"
elif [ $LOADING == 8 ]; then
printf "\r${COLOR_YELLOW}SecDevLabs: 👀 Your app is still starting... (------*-) ${COLOR_RESET}"
elif [ $LOADING == 9 ]; then
printf "\r${COLOR_YELLOW}SecDevLabs: 👀 Your app is still starting... (-----*--) ${COLOR_RESET}"
elif [ $LOADING == 10 ]; then
printf "\r${COLOR_YELLOW}SecDevLabs: 👀 Your app is still starting... (----*---) ${COLOR_RESET}"
elif [ $LOADING == 11 ]; then
printf "\r${COLOR_YELLOW}SecDevLabs: 👀 Your app is still starting... (---*----) ${COLOR_RESET}"
elif [ $LOADING == 12 ]; then
printf "\r${COLOR_YELLOW}SecDevLabs: 👀 Your app is still starting... (--*-----) ${COLOR_RESET}"
elif [ $LOADING == 13 ]; then
printf "\r${COLOR_YELLOW}SecDevLabs: 👀 Your app is still starting... (-*------) ${COLOR_RESET}"
fi
LOADING=$((LOADING+1))
# End of loading animation
done
if [ $TRIES == 0 ]; then
printf "\n${COLOR_RED}SecDevLabs: Ooops! Something went wrong, please check api details for more information!\n${COLOR_RESET}"
else
printf "\n${COLOR_GREEN}SecDevLabs: 🔥 ${PROJECT} is now running at ${COLOR_RESET}${COLOR_BLUE}http://localhost:$PORT${COLOR_RESET}\n"
fi