Multiple windows services under one project creating issues - service

I've created one project for windows services which holds multiple windows services and its installers.
Whenever I install my services project it install both the services but whenever I start my services, it always start 1st service only.
For Example
I've created one project "MyProjet.Services"
Which holds 2 services
Service1
Service2
I installed this services with following commands.
installutil MyProject.Services.exe
its able to create 2 services (Service1,service2), able to see them in Services.msc
Then I try to start services with commands:
SC start Service1 param1 param2
Services.msc : Service1 status: Running
SC start Service2 param1 param2
Services.msc : Service2 status: Running
But in my log file it shows logs for 1st service only.
In start event of both of the services, I've created log saying "Service1/2 is started".
But whenever I start service2 it always says Service1 is started.
it seems like its not able to start another service.
Is there anything I'm missing?
Regards,
Mox Shah

Related

Restarting a service in powershell vs restarting as myself yields different results

Context: I want to deploy some software automatically and restart the Apache2.4 service as part of that deployment.
I've been racking my brains trying to figure out why restarting a service via powershell is different from restarting it as myself via services.msc.
Basically I have a local site I'm browsing to. After deploying the files for the site, I need to restart the Apache2.4 service.
Scenario 1: If I restart the service myself (by going to services.msc and right clicking Restart) - then I can browse to my site.
Scenario 2: If I restart the service via powershell (via a batch file that calls a powershell script that runs the command Restart-Service -DisplayName "Apache2.4") then I can't browse to my site. No matter how many times I do it through powershell, it won't let me load the site.
In both scenario 1 and 2 above the service DOES restart. I have confirmed so via the event viewer. That's why I am so confused by what is happening. Has anyone come across this?

Install4j service not started on machine reboot for Suse Enterprise Linux

We have created an application using Install4j. This application has a service, created by using "Install a Service" action, with "auto start" attribute set.(The application launcher is a "Service" type with unix option "Auto-start service for Linux packages".)
For CentOS7, CentOS6, ,RHEL7, RHEL6 platforms the service starts automatically when the system is rebooted.
For Suse Enterprise Linux 12.x series, the service could not be started on system boot up. It is working fine, when invoked manually by command "/etc/init.d/{service-name} start".
When we check for the deployed files, the service file is copied to /etc/init.d/ folder and corresponding entries K50{service-name}, S50{service-name} files created at /etc/init.d/rc2.d/, /etc/init.d/rc3.d/, /etc/init.d/rc4.d/, /etc/init.d/rc5.d/. The service is turned on by chkconfig for 2,3,4,5 run levels. But when we reboot the machine, this particular service is not even attempted in the startup process.
Please suggest.

Wildfly deployment scanner

I am new to WildFly and I am trying to know more on deployment scanner process.
There are two deployment mode in WildFly auto deploy mode and manual.
If I restart WildFly, my ear files are deploying again. As per WildFly forum it should deploy again if there is a change in file(based on time-stamp).
I am running my WildFly in standalone mode.
When I run the following command:
sh standalone.sh -b 0.0.0.0
and its started within 2 minutes. Again if I restart server is taking same time.
It is re-deployed using timestamp only in a running instance. An application needs to be deployed to 'run' thus when the servcer starts it deploys the applications and stops aka undeploys them when it stops.
Whenever you deploy anything on wildfly manually ( I mean using admin console ) , it put a entry in standalone.xml ( or other xml if you configure to use them ). You will find an entry referring to it. With this during next restart it knows what to re-deploy.
In scanner mode , it know location of scanner directory and during startup , it picks content from it.
Now for >>>>> As per WildFly forum it should deploy again if there is a change in file(based on time-stamp).
Ans : If autodeployed is true ; then while server is running and you update any file , it will be picked up and wildfly will re-deploy app.
Hope this helps

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?
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.
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
To resolve it, first create Windows auto-logon as I explain here:
https://serverfault.com/questions/269832/windows-server-2008-automatic-user-logon-on-power-on/606130#606130
Then create a startup batch for Jenkins agent (place it in Jenkins directory). This will launch agent console on desktop, and should allow Jenkins to interact with Windows GUI:
java -jar slave.jar -jnlpUrl http://{Your Jenkins Server}:8080/computer/{Your Jenkins Node}/slave-agent.jnlp
(slave.jar can be download from http://{Your Jenkins Server}:8080/jnlpJars/slave.jar)
EDIT :
If you're getting black screenshots (when using Selenium or Sikuli, for example), create a batch file that disconnects Remote Desktop, instead of closing the RDP session with the regular X button:
%windir%\system32\tscon.exe %SESSIONNAME% /dest:console
Consider running the Java slave server directly at startup and then using something to monitor and restart should the server go down (e.g., Kiwi Restarter).
Please check the services (# TestNode) make sure the "Interactive Services Detection" service is STARTED, by default the startup type is set to Manual, you may like to set it to automatic as well.
After service started, when you run your test in the Test Node, you will see something like the below:
Click on it and choose view the message
You will see the activities happen there. Hope this helps :D
Note: If login with other account and cannot view the Interative Services Detection prompt, restart the service again.
My Jenkins Service runs as user "jenkins" and all I did was to create Desktop folders in: C:\Windows\system32\config\systemprofile\desktop and if 64 bit Windows also in C:\Windows\SysWOW64\config\systemprofile\desktop - then it runs perfectly.
Make sure that Desktop folders are created as such:
%WINDOWS%/System32/config/systemprofile/Desktop
%WINDOWS%/SystemWOW64/config/systemprofile/Desktop
Presence of those can sometimes be mandatory while running some Java software as a Service.

How to start a jboss as a service without rebooting the system

I'm struggling with the start of jboss as a service. I have a batch file i.e test.exe where i have written a script to start a Jboss as a service..
cd "C:\Program Files (x86)\empl\jboss7\bin"
service install
ECHO "Jboss Starting......."
service start
TIMEOUT /T 20
ECHO "Jboss Started
and even i tried NET START "JBAS70SVC" where JBAS70SVC is service name .
I'm able to install service but when i check status of my service in SERVICES folder of windows 7 its not started
When i reboot my system then i can see status "STARTED" and my application runs.
how can i start my service without rebooting the system ?
SC START Service
See SC /?
I need to add these chars to reach min post requirements :)