.bashrc设置开机启动没有生效。如何开机自启动?
Tofloor
poster avatar
aifish
deepin
2018-04-11 19:44
Author
我按照论坛的帖子一一试过。

软件没有界面,所以不能用右键方式添加自启动。
.bashrc里的命令,必须在我手工打开过深度终端后才能运行。
/etc/profile里的命令,不会被自动运行。
/etc/rc.local  也没用。

请问怎么办?


Reply Favorite View the author
All Replies
avatar
aifish
deepin
2018-04-21 02:24
#1
.bashrc 和 /etc/rc.local  都不能开机启动。 必须开机后计入终端才会被运行。 请问如何做
Reply View the author
avatar
iseric
deepin
2018-04-21 03:37
#2
看了一下,你的要求好像是要在用户还没登录系统的时候就开始运行指定程序对吧。
那么建议使用 root 用户创建 systemd 守护进程,然后
  1. sudo systemctl enable xxx.service
Copy the Code

systemd.service 保存在 /lib/systemd/system 里,格式可参照https://www.freedesktop.org/software/systemd/man/systemd.service.html
Reply View the author
avatar
Lyvnee
deepin
2018-04-21 03:50
#3
新建  .xsessionrc 添加命令,可以开机启动
Reply View the author
avatar
139******14
deepin
2018-04-21 17:33
#4
商店搜索Stacer就可以了
之前我也是这个问题,用这个工具开机启动搞定了
还连带着清理垃圾文件
Reply View the author
avatar
a-wing
deepin
2018-04-21 20:33
#5
.bashrc 是运行bash 才会被执行,默认又不运行。。。。。

/etc/rc.local  在deb系是可以开机运行的(除非deepin改了)。/etc/rc.local 这里要写绝对路径,而且是以root 运行的,要写在  exit 0 之前

采用什么方式具体要看需要在什么时候启动
systemd.service 也可以
.xsessionrc 也可以

写可以添加到 ~/.config/autostart/ 里或 ~/.xprofile
Reply View the author
avatar
gointoaction
deepin
2018-04-22 02:59
#6
/etc/rc.local 确实不行,在linuxmint可以,在deepin就失效了
Reply View the author
avatar
deepinuser17
deepin
2018-04-22 08:34
#7
查看一下/etc/rc.local是否是可执行文件。用Systemd的系统,/etc/rc.local的执行文件设置已经默认被取消了。

ls -l /etc/rc.local
ls -l /etc/rc.d/rc.local

chmod +x /etc/rc.d/rc.local /etc/rc.local

/etc/rc.local有可能是链接
Reply View the author
avatar
aifish
deepin
2018-04-27 18:31
#8
本帖最后由 aifish 于 2018-4-27 10:41 编辑
https://bbs.deepin.org/post/155226
商店搜索Stacer就可以了
之前我也是这个问题,用这个工具开机启动搞定了
还连带着清理垃圾文件 ...

我试用了你这个方法。并不能开机启动。我这个命令手工运行,是可以启动jupyter的。请问您知道哪里出错了么?
Reply View the author
avatar
139******14
deepin
2018-04-28 01:40
#9
https://bbs.deepin.org/post/155226
我试用了你这个方法。并不能开机启动。我这个命令手工运行,是可以启动jupyter的。请问您知道哪里出错了么 ...


第一行:应用名称
第二行:说明信息
第三行:完整执行路径

如果你不清楚路径 那么请按CTRL+ALT+T呼出终端,把要运行的文件拖进窗口可以看到程序路径
Reply View the author
avatar
aifish
deepin
2018-04-29 06:09
#10
https://bbs.deepin.org/post/155226
第一行:应用名称
第二行:说明信息
第三行:完整执行路径

多谢了  终于成功了
原来这里的命令需要是全路径,并且不加nohup  也不用指定输出日志位置。
Reply View the author