歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> Linux配置開機自啟動時要注意的PATH問題

Linux配置開機自啟動時要注意的PATH問題

日期:2017/2/28 16:24:06   编辑:Linux教程

升級了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時,最不在意的“-”,後果有時很嚴重,呵呵

Copyright © Linux教程網 All Rights Reserved