Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins windows slave service does not interact with desktop

I have followed this guide to install a jenkins slave on windows 8 as a service:

https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins+as+a+Windows+service#InstallingJenkinsasaWindowsservice-InstallSlaveasaWindowsservice%28require.NET2.0framework%29

I need to run a job that interact with the desktop (run an application that opens a browser etc.). So after I have installed the slave as a service (running jnlp downloaded from the master) I have changed the service "Log on" to "Allow to interact with display".

For some reason its only possible to enable this for the "Local System account" even though its recommended to run the service as a specified user, eg. jenkins.

But nothing happens when I execute the job, the browser is not opened. If I instead stop the service and just launch the slave through the jnlp file the job runs fine - the browser is opened.

Anybody had any luck interacting with the desktop when running a jenkins windows slave as a service?

like image 675
u123 Avatar asked Sep 19 '13 23:09

u123


2 Answers

Services run since Vista in Session 0 and the first user is now in Session 1. So you can't interact any longer. This is called Session 0 Isolation.

Microsoft explains this here and here. You have to use 2nd Program which uses IPC to communicate to the Service.

like image 179
magicandre1981 Avatar answered Oct 12 '22 16:10

magicandre1981


I had lots of issues running Jenkins in Windows using the service. Instead I now disable the service and run it from CMD.

So open CMD.

cd C:\Program Files (x86)\Jenkins

java -Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar
jenkins.war --httpPort=9091
like image 33
Ian Thompson Avatar answered Oct 12 '22 18:10

Ian Thompson