-
Notifications
You must be signed in to change notification settings - Fork 0
/
spub_launch.sh-templ
45 lines (33 loc) · 1.11 KB
/
spub_launch.sh-templ
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
#!/bin/bash
# Check if jupyter4all is enabled
CERT=$HOME/.certs/nb.pem
CKEY=$HOME/.certs/nb.key
if [ ! -f "$CERT" ] || [ ! -f "$CKEY" ]; then
echo "!"
echo "#####################################################"
echo "# ERROR: Rescale App failed to start. #"
echo "# Make sure the jupyter4all flag is enabled. #"
echo "#####################################################"
echo "!"
return 1
fi
. ~/jupyter-venv/bin/activate
RESCALE_PYTHON_TOKEN=$(jupyter notebook list | grep token | sed --regexp-extended 's/.*token=([a-z0-9]*).*/\1/g')
MATCH="jupyter"
function killall() {
proc_arry=($(ps -ef | grep $1 | awk '{print $2}'))
for i in "${proc_arry[@]}"; do
kill -9 $i
done
}
killall $MATCH
deactivate
MOUNT_POINT="%MOUNT_POINT%"
VERSION="%VERSION%"
INSTALL_DIR=$MOUNT_POINT/$VERSION
eval "$(/${INSTALL_DIR}/miniconda/bin/conda shell.bash hook)"
conda activate RESCALE
cd $INSTALL_DIR
# Start daemonized (in the background), so the main proces exits and the actual
# simulation can start
gunicorn --daemon --certfile $CERT --keyfile $CKEY -b 0.0.0.0:8888 app:server