Blog About Contact

Use Hudson (now Jenkins) to restart a Windows service...

Published Fri, 21 Jan 2011 • 1 comments

Here's a quick tip - you can easily make Hudson restart a windows service, by using its "Windows Batch Command" build step in combination with the command line windows "net" command.

Here's an example of how we can get Hudson to restart Apache running on the same host -

  1. Create a new Job, say "Restart Apache" as a standard Hudson job.
  2. Add a new "Windows batch command" step, and in the box enter -
    net stop Apache2
  3. Add another new "Windows batch command" step, and in the box enter -
    net start Apache2
  4. Run the job, and behold!

This is handy if you're automating deployments usnig Hudson on Windows hosts. Particularly if you're trying to avoid PermGen issues with hot-redeployments on say, Apache Tomcat.

About the Author

Richard Nichols is an Australian software engineer with a passion for making things.

Follow him on twitter or subscribe by RSS or email.

You might also enjoy reading -

Discuss / Comment

There are 1 comments.

Add a comment

  • {{e.error}}

Thanks for your comment!/

Valid email address required.
Posting message, please wait...