我需要为我的Jetty服务器设置一些系统范围的环境variables。
但是把它们放在哪里? 似乎有2个select
/etc/profile或
/etc/profile.d ? 两者之间的差异是什么?
/etc/profile.d被使用,所以你可以打破一些在configuration文件中的设置。
例如,不要把vi的设置放在/ etc / profile中,我可以把它们放在/etc/profile.d/vi中
根据/ etc / profile顶部的注释
# /etc/profile # System wide environment and startup programs, for login setup # Functions and aliases go in /etc/bashrc # It's NOT a good idea to change this file unless you know what you # are doing. It's much better to create a custom.sh shell script in # /etc/profile.d/ to make custom changes to your environment, as this # will prevent the need for merging in future updates.
和实际的profile.d执行位
for i in /etc/profile.d/*.sh ; do if [ -r "$i" ]; then if [ "${-#*i}" != "$-" ]; then . "$i" else . "$i" >/dev/null 2>&1 fi fi done