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 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0
C:\WINDOWS\system32>sc query "fred"
[SC] EnumQueryServicesStatus:OpenService FAILED 1060:
The specified service does not exist as an installed service.
C:\WINDOWS\system32>
On Tue, Dec 3, 2019 at 5:56 AM Adakar <[email protected]> wrote:
> 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 message because you are subscribed to the Google Groups
> "Jenkins Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-dev/3193b476-8414-4c83-a3f3-a45cd6cbe1b5%40googlegroups.com
> <https://groups.google.com/d/msgid/jenkinsci-dev/3193b476-8414-4c83-a3f3-a45cd6cbe1b5%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
--
You received this message because you are subscribed to the Google Groups
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-dev/CAO1vCWEALq4afNdA6ToM0SuvYd%2BW_DSFJxpEzgYuSHT%2BWhWCTw%40mail.gmail.com.