forked from bi-lab/deeplearning_tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup_nbserver.py
36 lines (27 loc) · 1.08 KB
/
setup_nbserver.py
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
import os
home_dir = os.environ['HOME']
if os.path.isdir("$HOME/.ipython/profile_nbserver")is False:
os.system("ipython profile create nbserver")
else:
os.system("echo profile_nbserver is already exist.")
from IPython.lib import passwd
pwsha = passwd()
config_str = """
# Server config
c = get_config()
c.NotebookApp.ip = '*'
c.NotebookApp.open_browser = False
c.NotebookApp.password = u'{}'
# It is a good idea to put it on a known, fixed port
c.NotebookApp.port = 8888
c.NotebookApp.notebook_dir = u'/'
""".format(pwsha)
with open(home_dir+"/.ipython/profile_nbserver/ipython_notebook_config.py", "w") as cf:
cf.write(config_str)
#os.system("sudo printf \"\nexport PATH=/usr/local/cuda/bin:$PATH\nexport LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH\n\" >> /root/.bashrc")
#os.system("sudo printf \"\nshell -/bin/bash\n\" >> /root/.screenrc")
# this is usually make some error... do not use this!
#os.system("screen -dRR -dmS ipython_notebook ipython notebook --profile=nbserver;")
# https://www.gnu.org/software/screen/manual/screen.html
# screen install check
#