手机版
你好,游客 登录 注册
背景:
阅读新闻

Linux配置开机自启动时要注意的PATH问题

[日期:2011-01-25] 来源:Linux社区  作者:atechgreek [字体:大 中 小]

升级了rsync到新版本,默认他会安装到/usr/local/bin下,结果rc.local里加的自启动不好用了,找了半天终于在PATH Howto中发现:启动时的path只含有:   /usr/local/sbin   /sbin   /bin   /usr/sbin   /usr/bin偏偏就没有/usr/local/bin,简直。。。。。晕死~~,害我debug了半天,重启无数回测试。解决的方法,当然是在/usr/bin下创建一个link就好了。

这篇howto居然是97年写的,妄我还觉得自己玩了好些年呢,学无止境啊。

其中有这么一段:Init is a parent process for all the other processes of the system. Other processes inherit environment of the init process and the path is the init path in the rare case that no other path is set.

The 'init path' is fixed in the source of the init program and it is:

/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin

Note that init path does not contain /usr/local/bin. (看看,就这里写着呢。。。。)

All the programs that are started from /etc/inittab work in init environment, especially system initialization scripts in /etc/init.d (Debian 1.3).

Everything that is started from system initialization scripts has init environment as default environment. For example, syslogd, kerneld, pppd (when started from startup), gpm and most importantly lpd and inetd have init environment and they do not change it.

A group of programs are started from startup scripts but the PATH environment variable is explicitly set in the startup script. Examples are: atd, sendmail, apache and squid.

There are other programs that are started from boot scripts but they change the path completely. One such example is cron.

这篇文档里还有很多path方面的解释,包括我见过很多身边朋友在su时,最不在意的“-”,后果有时很严重,呵呵

linux
相关资讯       Linux教程 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款