后台运行jupyter notebook

jupyter notebook  --ip=0.0.0.0 --no-browser --allow-root > jupyter.log 2>&1 &
在想要jupyter访问的目录下:执行vim start_jupyter.sh,写如下内容:jupyter notebook  --ip=0.0.0.0 --no-browser --allow-root > jupyter.log 2>&1 &

让刚才生成的文件具有执行权限:chmod +x start_jupyter.sh,(此时权限又【-rw-rw-r--】变成【-rwxrwxr-x】,文件名变成绿色,后面有【*】)

执行刚才的文件:./start_jupyter.sh,(该进程在后台运行,同时会自动生成-rw-------   nohup.out文件)



解释: 1. 用&让命令后台运行, 并把标准输出写入jupyter.log中

    nohup表示no hang up, 就是不挂起, 于是这个命令执行后即使终端退出, 也不会停止运行.

2. 终止进程

    执行上面第2条命令, 可以发现关闭终端重新打开后, 用jobs找不到jupyter这个进程了, 于是要用ps -a, 可以显示这个进程的pid.
    kill -9 pid 终止进程

猜你喜欢

转载自www.cnblogs.com/wtil/p/10888973.html