I have a service MyService.exe that is babysitting my application MyApp.exe, meaning it starts the application when this one crashes or whatever. Basically when the service is stopped the application is stopped (by the service) and when the service is started the application is started by the service.
In order to stop my service and by that my application when uninstalling I'm doing:
<ServiceControl Id='MyServiceControl' Name='MyServiceForTest' Start='install' Stop='uninstall' Remove='uninstall'/>
But when I want to uninstall everything I get the error message: "The setup must update files or services that cannot be updated while the system is running. If you choose to continue, a reboot will be required to complete the setup.". If I manually stop the service before running the uninstaller I don't get this msg as both my service and my application aren't then running anymore.
In the log file I noticed that this happens in InstallValidate and I get this message b/c of MyApp.exe being running.
I think what happens is: the uninstallers checks the running applications, it notices that the MyService.exe and MyApp.exe are both running, detects probably that the MyService.exe will be stopped by the uninstaller itself as instructed, but doesn't know about the MyApp.exe that this one will also be terminated once the service will be stopped so it will show the reboot-message.
I can't just close MyApp.exe from uninstaller b/c the service will restart it again.
How could I solve this problem so that the user won't need to reboot or to manually stop the service before doing an uninstall/upgrade? Also, I can't change MyService and MyApp code anymore so I will have to do this from the (un)installer only.
TIA,
Viv
I would expose a mechanism in your service in which your installer can instruct it to stand down and terminate the application. This way when Windows Installer costing looks for locked files it doesn't find any.
Related
I'm trying to create an Install4j updater in unattended mode using Stand Alone Update Downloader and invoke it using the api. (this is working)
The application is a Windows Service and it opens http ports.
I would like to be able to rollback to the previous installed service if the new installed version isn't working. There should be no user interaction to do it.
What I was planning to do is:
Install the service
Start the service
Call Wait for Http Server Action that calls an Url of the service to check if my new updated service is working as intended.
If it doesn't returns a 2xx it will initiate the rollback process
But what I'm seeing is that the rollback process starts but it stops and uninstalls the new service but the previous service is never reinstalled.
What I would want it to do when rollbacking is:
Stop the new service
Uninstall it
Rollback any other files added by the new version
Reinstall the previous service
Start the previous service
Is there any way to achieve it ?
Edit:
I have those actions in the installer:
In this version of Install4j (10.0.4) the rollback mechanism doesn't handle this scenario. As specified by the comment of Ingo Kegel this will be improved in further version.
What is working with this version is that:
Add the condition on Install service to not to run it when updating like this: !context.isUpdateInstallation(). There will no rollback of the service when updating.
To keep the service started, we added a Stop a Service at the beginning. This way if there's a rollback, the Stop a Service will be rollbacked, so it will restart the service.
I have a working install4j 6.1.3 service. Due to a 3rd party memory leak we want to be able to have our application exit and then have the service automatically restart itself on a regular basis. There is a checkbox on the install4j create services option screen "Restart on Failure" that says that it should restart the service unless the exit code is '0'.
The java application is calling System.exit(27).
We have also tried codes -1, 0 and 1.
The application exits, but the windows service does not auto restart.
Is there something more that needs to be configured for this to work, or a different way to exit the java application to get the service to automatically restart itself?
Suddenly Websphere server is automatically started.
I stop many times but started again automatically.
Even I removed project from the web sphere and removed websphere from the project and Again add for the same.. But still I it is starting.
I also run the below command,
Server stop server_name
below Message is showing
Stopping server server_name
So it is not stoping. How to stop forcefully? or Kill existing process?
Your question doesn't state what OS you're running on, but Liberty doesn't currently ship with any means to automatically start the server (like a Windows service), so when you say "started again automatically", it is more likely that the server is never shutdown. Liberty runs as a process that can be killed and the process id can be determined by looking at the messages.log file in the server logs directory. The preamble of the file will contain a line like this:
process = 11488#YourHostName
Depending on the OS you're running on, you can use the kill command (Linux or MacOS), or the Windows Task manager to end the process. When you restart the server, you may want to specify the --clean option like this:
server start defaultServer --clean
I'm keeping the "Log On As" info on upgrade for the service I'm installing.
<InstallServices>NOT WIX_UPGRADE_DETECTED</InstallServices>
<DeleteServices>NOT UPGRADINGPRODUCTCODE</DeleteServices>
However, the upgrade fails if the user/password are incorrect.
How can I allow my service to fail to start?
I'm able to do this by adding
<ServicesStart>0<ServicesStart>
and using a custom action to start the services. Although it works, I don't quite like it.
The custom action simply runs a batch file with the following line:
net start FoobarService
I use quiet execution in the MSI, but running this batch file from the command line I have the following output:
System error 1069 has occurred.
The service did not start due to a log-on failure.
That's the expected behavior - the upgrade must proceed even if the service fails to start. If the service doesn't start, someone will notice it very quickly and will change the credentials.
I use Install4J to install my application which is comprised of two services (two launchers) from a single JAR. I want to update my application in Unattended mode, then stop both services and start both services without having to ask the user to enter the administrator's password. Both services are initially started as root and I have verified using the 'ps' command that they are running as root when one of the services calls the ApplicationLauncher.launchApplication Install4J Integration API method.
My Install4J Updater is able to download the new version and stop the calling launcher, but the problem that I'm seeing is that I'm not able to stop the second (non-calling launcher) nor am I able to start the calling launcher.
This error is very strange because I've noticed that if I stop both services and then start both services using
sudo <ServiceLauncher1> stop
sudo <ServiceLauncher2> stop
sudo <ServiceLauncher1> start
sudo <ServiceLauncher2> start
..the whole thing works. It downloads the update, stops both services, then starts both services just fine. I've noticed (in OSX) that the launcher icon for the auto updater is also different (black terminal icon (does not work) vs white java icon (works).
I'd very much appreciate some help on this. Thanks!
In my case (two services), the Update installer runs as a child process of the service that launched it. Due to part of the update process requiring both services to be stopped and then started the problem is that stopping the calling service causes the whole update installer to be killed.
My solution is to have each service stop/start the other one by using two Update applications in Install4J.
Service #1 --> Updater #1:
Check for new version
Download new version
Install new version
Stop Service #2
Start Service #2 (At this point, Service #2 is fully updated and running)
Notify Service #2 to perform update on Service #1
Service #2 --> Updater #2:
Stop Service #1
Start Service #1 (At this point, Service #1 is fully updated and running)