系统启动时不执行/etc/profile文件吗?
Tofloor
poster avatar
hummerstudio
deepin
2017-08-21 01:25
Author
我看到/etc/profile文件中会执行/etc/profile.d/目录下的脚本。
但是我把自己写的脚本放到此目录下,系统启动时并未执行。
还需要手动source一下才可以生效。
Reply Favorite View the author
All Replies
avatar
billy123456
deepin
2017-08-21 01:42
#1
不执行的
Reply View the author
avatar
billy123456
deepin
2017-08-21 01:42
#2
默认不执行
Reply View the author
avatar
hummerstudio
deepin
2017-08-23 15:46
#3
billy123456 发表于 2017-8-20 17:42
默认不执行

1.这是什么原理?怎么考虑的?
2.怎么样才能执行?
3.或者怎么样才能开机自动执行用户自定义的脚本?有没有提供规范的方式?
Reply View the author
avatar
Feng Yu
deepin
2017-08-23 17:21
#4
这些问题你都可以通过google以及阅读官方文档解决。我不知道你为什么一定认为/etc/profile会被加载?你看的是国内误人子弟的资料吧?那个文件本来就不是所有shell都必须加载的文件,在bash的官方文档也有提及。只有百度的资料都是抄的,还是多少年以前的资料,根本不验证。

参考这个问答(Ubuntu): https://askubuntu.com/questions/ ... e-not-being-sourced

以及debian的官方文档(这个更有说服力): https://wiki.debian.org/EnvironmentVariables
Reply View the author
avatar
deepinwang
deepin
2017-08-23 17:35
#5
建议楼主多多查阅资料。google不行可以用yahoo,bing也能凑合,不到万不得已千万不要用baidu。
如果懒得看英文,可以translate.google.cn全文翻译,当然最好还是能静下心来学习一个。

这里说的仅针对技术问题,其他问题另谈。
Reply View the author
avatar
hummerstudio
deepin
2017-09-07 05:00
#6
https://bbs.deepin.org/post/144449
这些问题你都可以通过google以及阅读官方文档解决。我不知道你为什么一定认为/etc/profile会被加载?你看的 ...

Graphical logins do not read a shell's startup files (/etc/profile and ~/.profile and so on) by default, but you as a user may choose to create a ~/.xsessionrc file which does this.

看到了,多谢!
Reply View the author
avatar
152******09
deepin
2017-09-07 18:38
#7
abcfy2 发表于 2017-8-23 09:21
这些问题你都可以通过google以及阅读官方文档解决。我不知道你为什么一定认为/etc/profile会被加载?你看的 ...

谢谢 我也纳闷  请问怎么google 有好的vpn推荐吗 谢谢大侠
Reply View the author
avatar
hummerstudio
deepin
2017-09-17 01:23
#8
abcfy2 发表于 2017-8-23 09:21
这些问题你都可以通过google以及阅读官方文档解决。我不知道你为什么一定认为/etc/profile会被加载?你看的 ...

你好,我按文档放在xsessionrc文件里,还是未生效,不知是什么原因?
Reply View the author
avatar
Feng Yu
deepin
2017-09-19 03:08
#9
https://bbs.deepin.org/post/144449
你好,我按文档放在xsessionrc文件里,还是未生效,不知是什么原因?

写到.xsession是图形化程序才会加载。理论上你的shell实际应该算伪终端,应该是ttyS的设备,所以你可以写到~/.bashrc(登录式)和~/.bash_profile(非登录式)
Reply View the author
avatar
qiujieqiong
deepin
2017-09-19 22:40
#10
用crontab
https://superuser.com/questions/685471/how-can-i-run-a-command-after-boot
Reply View the author