jupyter-lab设置自启动及远程连接开发环境

作者:绝世这天下 时间:2023-08-29 09:11:39 

1 创建JupyterLab运行脚本

首先找到jupyter-lab命令的位置,一般在~/.local/bin/下,可以创建shell脚本autoJupyterLab.sh:

#!/bin/sh
/home/myjetson/.local/bin/jupyter-lab

测试一下脚本的正确性::

./autoJupyterLab.sh

远程连接JupyterLab成功,说明运行脚本没问题。

2 添加JupyterLab Service文件

Ubuntu18通过systemd管理服务,因此添加服务来开机运行JupyterLab脚本。

服务Service保存在/lib/systemd/system和/etc/systemd/system下。在/etc/systemd/system下创建auto-jupyter.service服务:

[Unit]
Description=Auto Load JupyterLab
After=network.target

[Service]
Type=simple
User=your_username
ExecStart=/your_script_dir/autoJupyterLab.sh
Restart=on-failure
RestartSec=15s

[Install]
WantedBy=multi-user.target

3 设置Jupyter Service自启动

让systemd重新加载service文件:

sudo systemctl daemon-reload

然后设置auto-jupyter.service开机自启:

sudo systemctl enable auto-jupyter.service

这样配置就完成了。

4 测试自启动服务

试着手动运行auto-jupyter.service,看看服务写的有没有问题:

sudo systemctl start auto-jupyter.service
sudo systemctl status auto-jupyter.service

重启服务器,远程连接jupyterlab,大功告成!

来源:https://blog.csdn.net/weixin_52201738/article/details/128901779

标签:jupyter-lab,自启动,远程连接
0
投稿

猜你喜欢

  • 文字链接,怎么办?

    2008-08-04 13:18:00
  • 微信小程序利用Canvas绘制图片和竖排文字详解

    2023-08-20 02:35:43
  • python selenium爬取斗鱼所有直播房间信息过程详解

    2023-11-19 07:00:11
  • 再读《你是一个职业的页面重构工作者吗?》

    2009-02-11 12:22:00
  • 如何用Python提取10000份log中的产品信息

    2023-06-30 06:23:21
  • 教你使用vue-autofit 一行代码搞定自适应可视化大屏

    2024-05-09 09:05:53
  • js实现input+select组合 抛砖引玉

    2010-08-02 12:34:00
  • vue axios 二次封装的示例代码

    2024-05-28 15:55:04
  • 运行tensorflow python程序,限制对GPU和CPU的占用操作

    2022-07-03 02:49:26
  • Python中比较特别的除法运算和幂运算介绍

    2022-12-30 12:29:21
  • 关于MySQL的体系结构及存储引擎图解

    2024-01-20 14:52:46
  • python3实现单目标粒子群算法

    2023-02-27 05:55:09
  • 将mater库中的系统存储过程批量生成*.sql文件 通用且非常实用

    2012-06-06 20:03:43
  • 用SQL语句添加删除修改字段、一些表与字段的基本操作、数据库备份等

    2011-12-01 07:53:11
  • mysql慢查询的分析方法

    2010-08-03 14:51:00
  • Chrome插件开发系列一:弹窗终结者开发实战

    2024-04-29 13:42:04
  • Python ORM框架SQLAlchemy学习笔记之数据添加和事务回滚介绍

    2023-06-15 22:47:05
  • Keras构建神经网络踩坑(解决model.predict预测值全为0.0的问题)

    2023-03-28 04:05:22
  • 一个带采集远程文章内容,保存图片,生成文件等完整的采集功能

    2011-04-02 11:02:00
  • Python中属性和描述符的正确使用

    2021-08-14 04:26:45
  • asp之家 网络编程 m.aspxhome.com