RE: Shutdown Merlin gracefully
"Mansour Raad" <[email protected]>
| Newsgroups | gmane.comp.jakarta.avalon.user |
|---|---|
| Organization | IIT |
| Message-ID | <002401c48ec3$6ddb9310$1002a8c0@MERCURY> |
Aaron, No, prob. Thanks for the reply and the additional info. Regards, Mansour :-) -----Original Message----- From: Farr, Aaron [mailto:[email protected]] Sent: Monday, August 30, 2004 2:52 PM To: 'Avalon framework users' Subject: RE: Shutdown Merlin gracefully Hello Mansour! Sorry to not reply faster. I'm really behind on emails. :) > -----Original Message----- > From: Mansour Raad [mailto:[email protected]] > > Is there a way to shutdown Merlin programmatically ? rather than a Ctrl- > C ! I think Stephen already answered this one pretty well. Basically, if you're willing to write your own bootstrap code, then you can control Merlin anyway you want. Look at the Merlin CLI interface for an example of how this works. Otherwise you'll have to wait until we get the console and/or JMX facilities working. > In addition, how do you startup Merlin as a windows service with a > specified block ? There's a Merlin 3.3.0 windows installer that automatically installs Merlin as an NT service. It uses the Java Service Wrapper and you'll need to look at the wrapper.conf file for the details. This is the way I do it: 1. Install a basic instance of Merlin somewhere on the PC. Let's say it's C:\merlin 2. Now for each Merlin application I have a separate folder. Say C:\app1 and C:\app2. These can be anything. We'll call them the "app homes", okay? The layout for a single app will look like: C:\app1 merlin.properties \conf block.xml config.xml wrapper.conf \logs 3. The merlin.properties file will look something like: # Example merlin.properties file merlin.deployment=file:///${merlin.dir}/conf/block.xml merlin.override=file:///${merlin.dir}/conf/config.xml Which means that if you run 'merlin' from C:\app1 you will automatically launch the conf/block.xml and use the conf/config.xml file for configuration overrides. $merlin.dir means "the directory from which the merlin command was run." 4. For each application create a wrapper.conf file and use the Java Service Launcher to create a new Merlin service. The wrapper.conf file will even entries like: #******************************************************************** # Wrapper parameters #******************************************************************** # Java Application wrapper.java.command=%JAVA_HOME%/bin/java # Java Main class wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperSimpleApp # Java Classpath (include wrapper.jar) Add class path elements as # needed starting from 1 wrapper.java.classpath.1=%MERLIN_HOME%/bin/nt/wrapper.jar wrapper.java.classpath.2=%MERLIN_HOME%/system/merlin/jars/merlin-cli-3.3.0.j ar # Java Library Path (location of Wrapper.DLL or libwrapper.so) wrapper.java.library.path.1=%MERLIN_HOME%/bin/nt wrapper.java.library.path.2=%JAVA_HOME%/bin #wrapper.java.library.path.append_system_path=true # Java Additional Parameters wrapper.java.additional.1=-server wrapper.java.additional.2=-Djava.security.policy=%MERLIN_HOME%/bin/security. policy # Initial Java Heap Size (in MB) wrapper.java.initmemory=3 # Maximum Java Heap Size (in MB) wrapper.java.maxmemory=64 # Application parameters. Add parameters as needed starting from 1 wrapper.app.parameter.1=org.apache.avalon.merlin.cli.Main wrapper.app.parameter.2=-info So running "wrapper.exe -i conf/wrapper.conf" will create your application service. You'll need to get an understanding of the Java Service Wrapper (http://wrapper.tanukisoftware.org/doc/english/introduction.html) to pull this off. Hopefully this gives you something to start with. If you have more questions, please ask. jaaron --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]