如何在启动时启动ipython笔记本服务器作为守护进程

Tra*_*leu 19 python ipython

我喜欢ipython,特别是笔记本电脑的功能.我目前正在使用笔记本进程运行一个屏幕会话.如何将ipython的笔记本引擎/网络服务器添加到我的系统(CentOS5)启动程序中?

tic*_*ock 12

vi /usr/lib/systemd/system/ipython-notebook.service
#put the following in there.
-----------------8<------------------
    [Unit]
    Description=IPython notebook

    [Service]
    Type=simple
    PIDFile=/var/run/ipython-notebook.pid
    ExecStart=/usr/bin/ipython notebook --no-browser
    User=ipynb
    Group=ipynb
    WorkingDirectory=/home/ipynb/notebooks

    [Install]
    WantedBy=multi-user.target
-----------------8<------------------

# useradd ipynb
# su - ipynb # go there create notebooks dir
# systemctl daemon-reload
# systemctl enable ipython-notebook
# systemctl start ipython-notebook
Run Code Online (Sandbox Code Playgroud)

学分


sub*_*ean 6

也许放点像:

cd /path/to/notebookdir && ipython notebook --no-browser &
Run Code Online (Sandbox Code Playgroud)

/etc/rc.d/rc.local?这是'简单'的方式,我认为如果它只是你的个人机器,但如果它是一个'真正的'服务器你应该做一个完整的Sys V-init事情; 看到这个问题了解更多