forked from dusty-nv/jetson-containers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
start_jupyter
executable file
·30 lines (22 loc) · 1.22 KB
/
start_jupyter
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
#!/usr/bin/env bash
# This script will start JupyterLab server in the background (https://stackoverflow.com/a/44222911)
# There are some environment variables that you can set when starting the container to override the defaults:
#
# `--env JUPYTER_ROOT=/home/user`
# `--env JUPYTER_PORT=8888`
# `--env JUPYTER_PASSWORD=nvidia`
# `--env JUPYTER_LOGS=/data/logs/jupyter.log`
#
# The `/data` location is automatically mounted to your `jetson-containers/data` directory.
: "${JUPYTER_ROOT:=/}"
: "${JUPYTER_PORT:=8888}"
: "${JUPYTER_LOGS:=/data/logs/jupyter.log}"
: "${JUPYTER_PASSWORD:=nvidia}"
server_url="http://$(hostname -I | cut -d' ' -f1):${JUPYTER_PORT}"
printf "\nStarting JupyterLab server at $server_url (password \"${JUPYTER_PASSWORD}\")\n\n"
# python3 -c "from notebook.auth.security import set_password; set_password(\"${JUPYTER_PASSWORD}\", '/root/.jupyter/jupyter_notebook_config.json')"
/bin/bash -c "jupyter lab --ip 0.0.0.0 --port $JUPYTER_PORT --notebook-dir $JUPYTER_ROOT --allow-root &> $JUPYTER_LOGS" &
timeout 5 tail -f $JUPYTER_LOGS
printf "\nJupyterLab server is now started\n\n"
printf "JupyterLab URL: $server_url (password \"${JUPYTER_PASSWORD}\")\n"
printf "JupyterLab logs: ${JUPYTER_LOGS}\n\n"