-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhealthcheck_notebook.sh
executable file
·51 lines (42 loc) · 1.08 KB
/
healthcheck_notebook.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
#!/bin/bash
# Healthcheck 20200428
#jupyter --help
#jupyter notebook --help
#jupyter notebook list
#Currently running servers:
#http://0.0.0.0:8888/python/user/vre_buurmanmarineixxx/ :: /home/jovyan/work
# This will be checked:
OUTPUT=`jupyter notebook list`
#echo "OUTPUT: $OUTPUT"
#echo "JUPYTERHUB_USER: $JUPYTERHUB_USER"
#echo "BASE_URL: $BASE_URL"
#echo "Checking..."
### Check for username
RESULT_USERNAME="false"
if [[ $OUTPUT == *"$JUPYTERHUB_USER"* ]]; then
echo "JUPYTERHUB_USER there: $JUPYTERHUB_USER"
RESULT_USERNAME="true"
else
echo "JUPYTERHUB_USER missing: $JUPYTERHUB_USER"
exit 1
fi
echo $RESULT_USERNAME
### Check for BASE_URL:
RESULT_BASE_URL="false"
if [ -z ${BASE_URL+x} ]; then
echo "No BASE_URL set, omitting this check."
RESULT_BASE_URL="true"
elif [[ $OUTPUT == *"$BASE_URL"* ]]; then
echo "BASE_URL there: $BASE_URL"
RESULT_BASE_URL="true"
else
echo "BASE_URL missing: $BASE_URL"
exit 1
fi
echo $RESULT_BASE_URL
### Check the exit code
RESULT_EXITCODE=-99
jupyter notebook list
RESULT_EXITCODE=$?
echo "Exit code: $RESULT_EXITCODE"
exit $RESULT_EXITCODE