Re: Check if agent is running as a service

2019-12-07 Thread Mark Strasser
Do services start in headless mode? If so you could just query the system property "java.awt.headless"? https://www.oracle.com/technical-resources/articles/javase/headless.html Thanks -Mark -- You received this message because you are subscribed to the Google Groups "Jenkins Developers" group

Re: Check if agent is running as a service

2019-12-06 Thread Daniel Beck
> On 6. Dec 2019, at 21:02, Matt Sicker wrote: > > A low tech workaround for this would be using node labels to define > which nodes have the graphical environment and which ones don't. I wonder whether this is something that could be done automatically in platformlabeler plugin. Probably wo

Re: Check if agent is running as a service

2019-12-06 Thread Matt Sicker
A low tech workaround for this would be using node labels to define which nodes have the graphical environment and which ones don't. On Fri, Dec 6, 2019 at 4:05 AM Adakar wrote: > > Hi Daniel, > > Thanks for the explanation and pointing this out :) > > Bingo! The access to a display is mandatory

Re: Check if agent is running as a service

2019-12-06 Thread Adakar
Hi Daniel, Thanks for the explanation and pointing this out :) Bingo! The access to a display is mandatory for the plugin to be executed succesfully. That's exactly the reason why I wanted the plugin to stop the execution if the agent is running as a service. Although information if it is a se

Re: Check if agent is running as a service

2019-12-05 Thread Daniel Beck
On Thu, Dec 5, 2019 at 11:26 AM Adakar wrote: > My intention is to customize a plugin behavior based on the fact if the > agent is running as a service. If it does, it should stop the build. If > not, the build should be continued. I simply want my plugin to stop builds > which are executing on a

Re: Check if agent is running as a service

2019-12-05 Thread Adakar
My intention is to customize a plugin behavior based on the fact if the agent is running as a service. If it does, it should stop the build. If not, the build should be continued. I simply want my plugin to stop builds which are executing on agents that are running as a Windows Service. W dniu

Re: Check if agent is running as a service

2019-12-05 Thread Markus Winter
as you said you write a plugin you could just check what kind of launcher is configured for the agent within your Java code Anyway it would help to understand why you need to know if it is running as Windows Service. A couple of years ago we made the experience that running Windows agents via Serv

Re: Check if agent is running as a service

2019-12-04 Thread Jonathan Mackenzie
Yeah you can also use C:\WINDOWS\system32>net start | findstr "Jen" Jenkins C:\WINDOWS\system32> but it sounds to me like you have a wider use case here. Maybe you'd like to explain it? On Wed, Dec 4, 2019 at 2:14 AM Adakar wrote: > Hi Jonathan, > > Thank you for the answer! I know that

Re: Check if agent is running as a service

2019-12-04 Thread Adakar
Hi Jonathan, Thank you for the answer! I know that I can check that with the help of the "sc query " A problem I see with this solution is the lack of knowledge about the service name. Services can be installed under custom names(e.g. jenkinsslave-D__tmp_win_Agent), right? I wonder if there is

Re: Check if agent is running as a service

2019-12-03 Thread Jonathan Mackenzie
C:\WINDOWS\system32>sc query "jenkins" SERVICE_NAME: jenkins TYPE : 10 WIN32_OWN_PROCESS STATE : 4 RUNNING (STOPPABLE, NOT_PAUSABLE, ACCEPTS_SHUTDOWN) WIN32_EXIT_CODE: 0 (0x0) SERVICE_EXIT_CODE : 0

Check if agent is running as a service

2019-12-03 Thread Adakar
Hi There :) I'm working on a Jenkins plugin. I'm looking for a way to check if the Jenkins agent is running as a Windows service. So far my idea is to check if the WINSW_SERVICE_ID is set. Is there any other way? Any suggestions are highly appreciated :) BR, Adakar -- You received this messa