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 -
- Create a new Job, say "Restart Apache" as a standard Hudson job.
- Add a new "Windows batch command" step, and in the box enter -
net stop Apache2
- Add another new "Windows batch command" step, and in the box enter -
net start Apache2
- 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.
You might also enjoy reading -
- Quick Tip - Make Anything A Windows Service
- 1 Minute Guide - Installing Redmine on Windows
- 5 Minute Guide to Clustering - Java Web Apps in Tomcat
- Setting Up Memcached As A Windows Service
- Clever way of waiting for a specified delay in a DOS / Windows batch file...