简体   繁体   English

如何自动在ubuntu服务器上启动ipython Notebook?

[英]How to start ipython notebook on ubuntu server automatically?

I set up a cron task to start a ipython notebook server 我设置了一个cron任务来启动ipython笔记本服务器

#!/bin/bash
cd /home/.../.ipython/profile_nbserver
exec ipython notebook --profile=nbserver

When I run this script manually, I successfully launch the ipython server, however crontab fails to launch it. 当我手动运行此脚本时,我成功启动了ipython服务器,但是crontab无法启动它。 I set up a log file and it is empty. 我设置了一个日志文件,它是空的。

As a second attempt I set up a /etc/init/myipython.conf file 作为第二次尝试,我设置了/etc/init/myipython.conf文件

description: "ipython"
exec /home/effectivespend/anaconda/bin/ipython notebook --profile=nbserver --notebook-dir=/home/effectivespend/.ipython/profile_nbserver
start on filesystem and net-device-up IFACE!=lo

but this also fails. 但这也失败了。

Is it even possible to have a server run ipython in the background? 甚至可以让服务器在后台运行ipython吗? Is the crontab not the right approach to it? crontab不是正确的方法吗?

I basically want to launch it and have access to it via remote computers. 我基本上想启动它并可以通过远程计算机访问它。 (ie https://address:8888 ) (即https:// address:8888

Thanks 谢谢

I think the environment variables aren't setup when using cron. 我认为使用cron时未设置环境变量。 When you run your bash script, it has access to your ENV variables. 当您运行bash脚本时,它可以访问您的ENV变量。 Take a look here: 在这里看看:

https://stackoverflow.com/a/26062135/4080476 https://stackoverflow.com/a/26062135/4080476

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM