Blog About Contact

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

Published Fri, 21 Jan 2011

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

No one has commented yet.

Add a comment

  • {{e.error}}

Thanks for your comment!/

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