Esa*_*emo 8 linux redhat centos service environment-variables
我正在尝试启动需要 env 的服务。变量设置为特定路径。我在“/etc/profile.d/”中设置了这个变量。但是,当我使用service
命令启动此服务时,它不起作用。
男士服务:
service runs a System V init script in as predictable environment as possible,
removing most environment variables and with current working directory set to /.
Run Code Online (Sandbox Code Playgroud)
所以似乎service
正在删除我的变量。我应该如何设置变量以防止它们被删除。或者是我不应该做的事情。
我可以使用 init-scripts 手动启动服务,甚至可以将路径硬编码到脚本中,但我想知道如何通过service
命令使用它。
从 Fedora 16 开始,service
仅接受LANG
环境TERM
变量,其他所有内容都会被丢弃。因此,即使您当前的 {CentOS,RHEL} 以某种方式接受这些变量,也要为它不再工作的未来做好准备。
因此,对初始化脚本进行硬编码和/或在守护程序设置文件本身中设置变量将是您的选择。
归档时间: |
|
查看次数: |
25193 次 |
最近记录: |