I am presently using Phing and Jenkins to automate develops and deployment for my CodeIgniter application. One problem I am getting challenge with is restarting the apache service. I attempted in Phing but there is not enough permissions. What's the easiest method to restart?


After adding jenkins in to the sudoer file and exec'ing the service httpd restart, Jenkins throws: Process leaked file descriptors. Below is really a snippet from the Phing output via Jenkins. It states a workaround would be to install daemonize. Unsure what which means...

...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  ]


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

If you are on Linux you are able to run Phing using the sudo command to permit it enough rights to restart apache.

sudo phing restartapache

Presuming that restartapache is definitely an professional task that calls the apache restart command. Eg:

<target name="restartapache" description="Restarts the web server">
    <exec command="/etc/init.d/apache2 restart" />

To prevent the sudo command compelling for any password you are able to improve your sudo permissions for whatever user account you're running your build under (this situation demonstrates turning from the sudo password prompt for that jenkins user):

sudo visudo

Adding the next line:


I am not 100% sure concerning the security implications with this however i utilize it during my development atmosphere. It might be a little dodgy on production build systems.