小Script,不写原理,直接撸Code。
实现CentOS 6.9开机启动Jupyter Notebook。
1.编辑/etc/rc.local文件。添加如下语句:
su - python -c "/home/python/runJupyter.sh"
2.创建/home/python/runJupyter.sh文件,添加如下语句:
#!/bin/bash # screen -S jupyter -d -m bash -c "/home/python/startJupyter.sh; exec $SHELL"
3.创建/home/python/startJupyter.sh,添加如下语句:
#!/bin/bash # set -eux set -o pipefail cd /home/python/magedu/project/cmdb echo -e "Enter /home/python/magedu/project/cmdb" /home/python/.pyenv/versions/3.5.3/envs/magedu353/bin/jupyter notebook --ip=0.0.0.0 > /dev/null 2>&1 &