-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcf_java_check.sh
More file actions
41 lines (37 loc) · 1021 Bytes
/
cf_java_check.sh
File metadata and controls
41 lines (37 loc) · 1021 Bytes
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
#!/bin/bash
SPACES=($(cf spaces | awk '{print $1}' | tail -n +4))
echo "Choose a space:"
echo "0) All spaces"
for i in "${!SPACES[@]}"; do
echo "$((i+1))) ${SPACES[$i]}"
done
read -p "Enter space number: " SPACE_NUMBER
if [ $SPACE_NUMBER -eq 0 ]; then
for space in "${SPACES[@]}"; do
echo "Space: $space"
cf target -s $space
for app in $(cf apps | awk '{print $1}' | tail -n +5); do
echo " App: $app"
env=$(cf env $app)
if [[ $env == *"JAVA_HOME"* ]]; then
echo "$env" | grep 'JAVA_HOME'
else
echo "Java is not defined in the environment of $app."
fi
done
done
else
SPACE_INDEX=$((SPACE_NUMBER-1))
SPACE=${SPACES[$SPACE_INDEX]}
echo "Space: $SPACE"
cf target -s $SPACE
for app in $(cf apps | awk '{print $1}' | tail -n +5); do
echo " App: $app"
env=$(cf env $app)
if [[ $env == *"JAVA_HOME"* ]]; then
echo "$env" | grep 'JAVA_HOME'
else
echo "Java is not defined in the environment of $app."
fi
done
fi