问题
I have a jar file I'd like to run as a service on Windows, but I don't believe creating a Windows service is supported in Chef: CHEF-3865
How are Chef users adding new services to Windows machines they manage? Powershell?
My jar file is for the Jenkins Swarm Plugin, I am dynamically creating new swarm slaves using Chef.
回答1:
I was able to get this working using WinSW w/ a new Chef Cookbook.
Cookbook Steps:
- Download jar to node.
- Download winsw wrapper app to node.
- Download winsw config file to node.
- Update the winsw config file with node-specific info (jar to install, etc)
- Install the jar service wrapper: winsw.exe install (returns 0 if successful, 23 if already installed).
来源:https://stackoverflow.com/questions/23096451/how-are-windows-services-created-using-chef