-
Notifications
You must be signed in to change notification settings - Fork 2
/
status.sh
executable file
·34 lines (30 loc) · 994 Bytes
/
status.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
#!/usr/bin/env bash
BASE_PATH="$(dirname "$0")"
source $BASE_PATH/inc/init
# checking if docker VM is running ($DEVDOCKER_VM)
if [ -x "$DOCKERMACHINE_PATH" ]; then
source $BASE_PATH/vm-status.sh
echo
fi
DEVDOCKER_CONTAINERS="$(docker ps | (grep "\<$DEVDOCKER_IMAGE\>" || true))"
if [ "$DEVDOCKER_CONTAINERS" == "" ]; then
echo -ne "\033$TERM_COLOR_YELLOW"
echo "# All devdocker containers stopped"
echo -ne "\033$TERM_COLOR_NORMAL"
exit
fi
echo -ne "\033$TERM_COLOR_GREEN"
echo "# Devdocker containers running:"
echo -ne "\033$TERM_COLOR_NORMAL"
docker ps | head -n 1
echo "$DEVDOCKER_CONTAINERS"
echo
if [ -x "$DOCKERMACHINE" ]; then
source $BASE_PATH/inc/vm-eval
PORT_FW_PID="$(ps auwx | (grep "$SSH_PORT_FW_CMD" | grep -v 'grep' | grep -v 'sudo' || true) | awk '{print $2}')";
if [ "$PORT_FW_PID" != "" ]; then
echo -ne "\033$TERM_COLOR_GREEN"
echo "# Ports are forwarded using SSH"
echo -ne "\033$TERM_COLOR_NORMAL"
fi
fi