Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
用Jenkins或Phing重新启动apache_Apache_Codeigniter_Continuous Integration_Hudson_Phing - Fatal编程技术网

用Jenkins或Phing重新启动apache

用Jenkins或Phing重新启动apache,apache,codeigniter,continuous-integration,hudson,phing,Apache,Codeigniter,Continuous Integration,Hudson,Phing,我目前正在使用Phing和Jenkins为我的CodeIgniter应用程序自动化构建和部署。我遇到的一个问题是重新启动apache服务。我在Phing中尝试过,但没有足够的权限。重启的最佳方式是什么 编辑: 将jenkins添加到sudoer文件并执行服务httpd restart后,jenkins抛出:进程泄漏文件描述符。下面是Phing通过Jenkins输出的一个片段。它说一个解决方法是安装daemonize。不知道那意味着什么 ...Build_test > compress:

我目前正在使用Phing和Jenkins为我的CodeIgniter应用程序自动化构建和部署。我遇到的一个问题是重新启动apache服务。我在Phing中尝试过,但没有足够的权限。重启的最佳方式是什么

编辑:

将jenkins添加到sudoer文件并执行服务httpd restart后,jenkins抛出:进程泄漏文件描述符。下面是Phing通过Jenkins输出的一个片段。它说一个解决方法是安装daemonize。不知道那意味着什么

...Build_test > compress:

     [echo] YUI Compression started
     [echo] Replacing normal JS with compressed files.
     [echo] Replacing normal CSS with compressed files.
     [echo] chmoding assets
     [echo] YUI Compression ended

Build_test > pdepend:


Build_test > httpd_restart:

     [echo] Stopping httpd: [  OK  ]
     [echo] Starting httpd: [  OK  ]


BUILD FINISHED

Total time: 13.1424 seconds

Process leaked file descriptors. See http://wiki.jenkins-ci.org/display/JENKINS/Spawning+processes+from+build for more information
[JDepend] JDepend plugin is ready
[JDepend] Found 68 classes in 1 packages
Finished: SUCCESS

如果您在Linux上,可以使用sudo命令运行Phing,以允许它有足够的权限重新启动apache

sudo phing restartapache
假设restartapache是一个调用apacherestart命令的exec任务。例如:

<target name="restartapache" description="Restarts the web server">
    <exec command="/etc/init.d/apache2 restart" />
</target>  
然后添加以下行:

Defaults:jenkins !requiretty,!lecture
jenkins ALL=NOPASSWD:/etc/init.d/apache2

上面的内容已根据进行了编辑,以提高安全性,因此Jenkins只允许在没有密码的情况下重新启动apache,而无需其他任何操作。

使其在某些例外情况下正常工作。看看新信息的描述。授予詹金斯运行任何东西的全面许可是个坏主意。请参阅以了解如何改进您的解决方案。谢谢。我已经用您改进的解决方案更新了我的答案。在Jenkins中生成新流程存在问题。我想重启apache属于这一类,因为将创建一个新的进程id。您是否尝试将重新启动添加到生成后任务?我只是想知道为什么在完成压缩和phpdepend任务之后要重新启动Apache?你是在重建vhost配置还是什么?我在用APC。如果我不重新启动,有时我会得到一个白色的死亡屏幕。如果你知道APC解决这个问题的方法,让我知道:)但是他们有一个插件可以作为构建后任务重新启动apache吗?我实际上刚刚找到了这个插件,谢谢你的提示!但是如果我能在不重新启动apache的情况下修复死亡白屏问题,那就太好了!从未遇到过APC问题,但我会深入研究并尝试修复它,而不是通过apache重启来编写代码。祝你好运
Defaults:jenkins !requiretty,!lecture
jenkins ALL=NOPASSWD:/etc/init.d/apache2