我正在修改CentOS 7上的文件/ etc / sysconfig / httpd。
这个文件修改systemd下httpd服务的环境。
我想通过添加它来修改PATHvariables。 我可以设置它,但我正在努力与正确的语法添加到它。
如果我使用这个:
PATH="/export/home/www/perl5/bin:$PATH"
..然后我在PATH上得到的Apache实际上是:
/export/home/www/perl5/bin:$PATH
换句话说,它不是插入$ PATHvariables。
我尝试了一堆不同的语法,但我还没有得到它的工作。
有人知道正确的语法吗?
systemd在设置Environment =时不支持可变扩展 。 解决方法是拼出你需要设置的全套path。
否则,你粘贴的/etc/sysconfig/httpd的内容看起来好像对由systemdpipe理的Apache过渡有好的build议
man /etc/sysconfig/httpd # # This file is no longer used to configure additional environ‐ ment variables # for the httpd process. # # It has been replaced by systemd. If you want to customize, the best # way is to create a file "/etc/systemd/system/httpd.service", # containing # .in‐ clude /lib/systemd/system/httpd.service # ...make your changes here... # For more info about custom unit files, see # http://fedoraproject.org/wiki/Systemd#How_do_I_custom‐ ize_a_unit_file.2F_add_a_custom_unit_file.3F # To set OPTIONS environment variable which was set in this file # in older versions, you need to create a file named # "/etc/sys‐ temd/system/httpd.service" containing: # .include /lib/sys‐ temd/system/httpd.service # [Service] # # # # To pass additional options (for instance, ‐D definitions) to the # # httpd binary at startup, set OPTIONS here. # # # Environment=OPTIONS=‐DMY_DEFINE # Note: With previous versions of httpd, the MPM could be changed by # editing an "HTTPD" variable here. With the current version, that # variable is now ignored. The MPM is a loadable module, and the # choice of MPM can be changed by editing the configura‐ tion file # /etc/httpd/conf.modules.d/00‐mpm.conf. #
这是来自Fedora 23,但我相信它足够类似于给你指针,否则你自己的机器上运行“man / etc / systemd / httpd”。