[GeoNetwork-users] Run Jetty as Service/Scheduled task.

Hi all,

Second post so far on my new installation of Geonetwork.

I installed on win 2008 R2.

Everything works fine, except the server stops when i log off the machine.
Also, although there are other users with full admin priviliges, they cannot
use the start-geonetwork.bat scripts - they just won't work for them and I
don't know enough to fix that problem.

SO - has anyone made a scheduled task or service out of the
start-geonetwork.bat file?

I need to leave the server running when I am logged off and really really do
not want to install tomcat to get around this as everything is working right
now except for this.

Thanks for the help!

Giuseppe

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Run-Jetty-as-Service-Scheduled-task-tp5843356p5843356.html
Sent from the GeoNetwork users mailing list archive at Nabble.com.

On 12/16/10 3:36 PM, g.molinario@anonymised.com wrote:

Hi all,

Second post so far on my new installation of Geonetwork.

I installed on win 2008 R2.

Everything works fine, except the server stops when i log off the machine.
Also, although there are other users with full admin priviliges, they cannot
use the start-geonetwork.bat scripts - they just won't work for them and I
don't know enough to fix that problem.

SO - has anyone made a scheduled task or service out of the
start-geonetwork.bat file?

It used to be that the srvany.exe program could be used to invoke a program as a service so it could be configured to be automatically or manually started or stopped. Srvany hasn't been around since Windows 2003, but it turns out there is a way to still use it:

[from a post on technet.microsoft.com:]

   1. At the time of this posting, there is no Windows Server 2008
      Resource Kit Tools, so get the "*srvany.exe* " from the "*Windows
      Server 2003 Resource Kit Tools* " and copy it to a suitable
      location on your Win2008 server (e.g. *C:\Windows\System32\* ).
   2. Use "*sc* " to create a new service that launches "*srvany* "
      (e.g. *sc create MyService binPath= C:\Windows\System32\srvany.exe
      DisplayName= "My Custom Service"* )
   3. Using *RegEdit* : create a "*Parameters* " *key* for your service
      (e.g.
      *HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MyService\Parameters\*
      )
   4. Using *RegEdit* : within the newly created "*Parameters* " *key* ,
      create a *string value* called "*Application* " and enter the
      *full path to the application* you are wanting to run as a
      service. (No quotes required.)

So, you should be able to invoke the path to 'start-geonetwork.bat' and be able to leave it running after you logout.

I need to leave the server running when I am logged off and really really do
not want to install tomcat to get around this as everything is working right
now except for this.

Thanks for the help!

Giuseppe

--
Douglas D. Nebert
Senior Advisor for Geospatial Technology, System-of-Systems Architect
FGDC Secretariat T:703 648 4151 F:703 648-5755 C:703 459-5860

Dear Douglas,

Thanks for setting me on the right path!

Your instructions worked, with one exception - in 2008 R2, since it's 64
bit, the srvany.exe will not work unless invoked with the instsrv.exe.

Some info is here:

http://social.msdn.microsoft.com/Forums/en/netfx64bit/thread/b6f52aae-c1cb-4b57-8d82-6aa5ba18441a

and the instructions on how to use instsrv.exe are here:

http://support.microsoft.com/kb/137890

Once we figured that out, we were able to create the service properly.

The service starts, HOWEVER, it does not successfully launch jetty or
geonetwork. I have no idea why. Somehow, the service (or the scheduled task
i also tried to create) have instructions to run the start-geonetwork.bat
with my admin priviliges account, but they still encounter problems in
running the batch file, and fail.

If only there were a similar commad to nohup in windows, i'd use that. If I
can't figure it out I guess I'll have to migrate to tomcat....

thx

giuseppe

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Run-Jetty-as-Service-Scheduled-task-tp5843356p5843929.html
Sent from the GeoNetwork users mailing list archive at Nabble.com.

Dear Giuseppe,
Did you try this: Make Jetty as Windows Service | Eureka!
If it works, it would be great if you could provide a small write up of what you did and we could work on including the required wrapper and config file in the GeoNetwork package.
Greetings,
Jeroen
____________________________________________________
GeoCat introduces Bridge©
An extension to ArcGIS© to instantly publish data and metadata on GeoServer and GeoNetwork.
See http://geocat.net for more details.

Jeroen Ticheler
GeoCat bv
Irisstraat 52
7531 CW Enschede
The Netherlands
Tel: +31 (0)6 81286572

Please consider the environment before printing this email.

On 17 dec 2010, at 00:20, g.molinario@anonymised.com wrote:

Dear Douglas,

Thanks for setting me on the right path!

Your instructions worked, with one exception - in 2008 R2, since it's 64
bit, the srvany.exe will not work unless invoked with the instsrv.exe.

Some info is here:

Microsoft Q&A | Microsoft Learn

and the instructions on how to use instsrv.exe are here:

http://support.microsoft.com/kb/137890

Once we figured that out, we were able to create the service properly.

The service starts, HOWEVER, it does not successfully launch jetty or
geonetwork. I have no idea why. Somehow, the service (or the scheduled task
i also tried to create) have instructions to run the start-geonetwork.bat
with my admin priviliges account, but they still encounter problems in
running the batch file, and fail.

If only there were a similar commad to nohup in windows, i'd use that. If I
can't figure it out I guess I'll have to migrate to tomcat....

thx

giuseppe

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Run-Jetty-as-Service-Scheduled-task-tp5843356p5843929.html
Sent from the GeoNetwork users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
_______________________________________________
GeoNetwork-users mailing list
GeoNetwork-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geonetwork-users
GeoNetwork OpenSource is maintained at http://sourceforge.net/projects/geonetwork

Hi Guiseppe,

I wrote a very small app in Visual Studio 2008 that runs from the bin directory of the GeoNetwork install to do this. It's called GeoNetworkService.exe

When you've installed it in the bin directory of your GeoNetwork install, you can add it to the windows service list using:

sc create geonetwork binPath="C:\YourGeoNetworkInstallDir\bin\GeoNetworkService.exe"

After that you can use the services control panel to start/stop geonetwork. There is an executable in the BlueNetMEST sandbox which you can get by browsing the sandbox from this url:

I haven't put the source code up there yet but will do it when I get to my windows machine over the weekend.

It would probably be better if the Jetty Windows service mentioned by Jeroen was used instead though.

Cheers,
Simon
________________________________________
From: g.molinario@anonymised.com [g.molinario@anonymised.com]
Sent: Friday, 17 December 2010 10:20 AM
To: geonetwork-users@lists.sourceforge.net
Subject: Re: [GeoNetwork-users] Run Jetty as Service/Scheduled task.

Dear Douglas,

Thanks for setting me on the right path!

Your instructions worked, with one exception - in 2008 R2, since it's 64
bit, the srvany.exe will not work unless invoked with the instsrv.exe.

Some info is here:

and the instructions on how to use instsrv.exe are here:

Once we figured that out, we were able to create the service properly.

The service starts, HOWEVER, it does not successfully launch jetty or
geonetwork. I have no idea why. Somehow, the service (or the scheduled task
i also tried to create) have instructions to run the start-geonetwork.bat
with my admin priviliges account, but they still encounter problems in
running the batch file, and fail.

If only there were a similar commad to nohup in windows, i'd use that. If I
can't figure it out I guess I'll have to migrate to tomcat....

thx

giuseppe

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Run-Jetty-as-Service-Scheduled-task-tp5843356p5843929.html
Sent from the GeoNetwork users mailing list archive at Nabble.com.

Hi Simon,

Your geonetworkservice.exe worked perfectly.

Just one note, in Windows 2008 R2 the command sc does not work, instead the
command instsrv needs to be used. The syntax is a little bit different but
it succesfully installed the service.

Thank you very much!

G.
--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Run-Jetty-as-Service-Scheduled-task-tp5843356p5847214.html
Sent from the GeoNetwork users mailing list archive at Nabble.com.

Hi Jeroen,

Good to hear from you again - It's been a long time.

I had not seen the link you provided.

I checked it out, but to work it needs some elements of jetty that are not
installed with the geonetwork installation. I did not know where to go find
these - I am presuming they are part of the default installation of jetty,
and were simply not included in the version of jetty in the geonetwork
package.

<Jetty_Home>/bin/Jetty-Service.exe
<Jetty_Home>/bin/jetty-service.conf
<Jetty_Home>/etc/jetty-win32-service.xml
<Jetty_Home>/lib/win32

I was about to go hunt these down when Simon posted his
geonetworkservice.exe which so far works well.

I am a little swamped for time but I agree it would be great to see this
wrapper as part of the standard geonetwork configuration - if i get to it
I'll let you know of course.

Thanks again for your help!

Giuseppe

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Run-Jetty-as-Service-Scheduled-task-tp5843356p5847223.html
Sent from the GeoNetwork users mailing list archive at Nabble.com.