[izpack-users] Is it possible to stop a service via the install.xml?

Miraodb miraodb at hotmail.com
Thu Jan 12 11:10:17 CET 2006


Hi,

I'm so happy to see i'm not the only struggling with services.
Here's my opinion on the subject.

I had to sart and stop the application i install with IzPack as a service
and i found myself in a very tricky situation. Shall i use JNI or shall i
simply run a command line call just like you did.
I tried both and ended up with JNI for some obvious reasons.
First of all, the command line can get very bothering when you have to use
it on different machines with different OSs. even though it's W32 it can be
XP, 2000, 98 whatever... which don't have the same system folders and so on.

I simply hate MicroBullSh$$$ for that matter. (A personnal statement though
:-) ).

So what did i do ?

I created an executable (since we're talking about win32 app) using C++
Service API. i can share the code no problem. This code can start, stop,
create or delete services. and i use it in two ways.
First one at installation i call it with a set of arguments from a batch in
the processpanel. (i'm a fan of processpanel).
Second one, i generate a specific executable to stop the service coz this
one is what i could call a "sub-sub-service". One call the other... i needed
to find the parent process ID and so on...  but that's a personal problem
that you might not have to deal with.

In anyways you have also the possibily to use java-service-wrapper
http://wrapper.tanukisoftware.org/doc/english/introduction.html
it's a wonderful tool that can create a service from a java class. Once the
service created the wrapper can do almost everything you ever dreamed for
with it.

Now the last solution. the command line.
For one thing i don't understand why you use this mysql.xml ? Why not simply
use a batch or sh from the processpanel ? it's fairly easy and have some
advantages.one of them is that you can pass it arguments which can be parsed
during installation such as variables

Alright, this might be a bit messy. lots of info and not so much details.
If anything of what i said fits your requierements i would be happy to help
you to go further.

Cheers,
fabrice

----- Original Message ----- 
From: "Yossi Baram" <yossiba at eldat.com>
To: <izpack-users at lists.berlios.de>
Sent: Thursday, January 12, 2006 8:24 AM
Subject: [izpack-users] Is it possible to stop a service via the
install.xml?


Hi guys,
After installation I have mysql service and jboss(service I have
created) running.
During uninstall I need to stop those services in order to delete mysql
and jboss llibrary.
Trying to use the following in mysql.xml:


       <target name="uninstall_target">
                <exec executable="c:\winnt\system32\net">
                        <arg value="STOP"/>
                        <arg value="mysql"/>
                </exec>
                <deltree dir="${MYSQL_ADMINISTRATOR_FOLDER}"/>
                <deltree dir="${MYSQL_FOLDER}"/>
                <delete file="${MY.INI}"/>
                <deltree dir="${MYSQL_LOG_FILE}"/>
       </target>

Doesnt stop mysql service and an error is raised - cannot delete file
mysqld-max-nt.exe because it may be in use.
It happens because the service wasnt stoped and trying to delete mysql
library cannot take place.

How can I make mysql service to stop?
Can I do it in mysql.xml? or better in install.xml file?

Thanks guys

Yossi







More information about the izpack-users mailing list