-
Notifications
You must be signed in to change notification settings - Fork 4
/
cmd.sh
executable file
·26 lines (24 loc) · 996 Bytes
/
cmd.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
#!/bin/bash
# https://www.howtogeek.com/howto/30184/10-ways-to-generate-a-random-password-from-the-command-line/
TOKEN=$(tr -cd '[:alnum:]' < /dev/urandom | fold -w32 | head -n1)
echo "#"
echo "# Data Science 4 Effective Operations"
echo "#"
echo "# starting jupyter notebook&lab ... "
echo "$TOKEN" > token.txt
jupyter notebook --ip 0.0.0.0 --port 9999 --NotebookApp.token="$TOKEN" &> notebook.log &
jupyter lab --ip 0.0.0.0 --port 9998 --NotebookApp.token="$TOKEN" &> lab.log &
sleep 3
printf "done\n"
PUBLIC_IP=$(curl -s icanhazip.com)
LAB_LINK="http://%s:9999/?token=c10c04d634cc2bdf3b9a5a45485e682e1ffbc21a75f88f97"
printf "#\n"
printf "# Notebook:\n"
printf '# * local url: http://%s:9999/?token=%s\n' "0.0.0.0" "$TOKEN"
printf '# * public url: http://%s:9999/?token=%s\n' "$PUBLIC_IP" "$TOKEN"
printf "#\n"
printf "# Lab:\n"
printf '# * local url: http://%s:9998/?token=%s\n' "0.0.0.0" "$TOKEN"
printf '# * public url: http://%s:9998/?token=%s\n' "$PUBLIC_IP" "$TOKEN"
printf "#\n"
bash