[Geoserver-users] how to get geoserver start after boot

Ben,

many thanks for your detailed instructions, that helped me a lot.

I adjusted your steps to my environment on a suse server.

Now I wrote a documentation of the server setup with systemd on a suse
server:

https://t2792.greatnet.de/dokuwiki/index.php/Systemd#Installation_von_geoserver

These instructions are only required if the bin.zip is used. That means, if the geoserver should be installed without using tomcat,
it is necessary to provide a systemd unit file as described.
An alternative is to use the war.zip and the distribution provided tomcat instance and user.

The documentation may help some other people like me.

Regards from Austria
Ferdinand

Am 09.01.2016 um 00:22 schrieb Ben Caradoc-Davies:

Ferdinand,

systemd has backwards-compatible support for initscripts, but the
script you linked to references an ancient geoserver.

Most production deployments I have seen use the -war.zip distribution
of GeoServer with the war file deployed in Tomcat behind Apache. On
systemd systems, startup configuration (systemd units) are provided
for their distributions of Apache and Tomcat. Because you are using
the provided system facilities, you never have to worry about systemd.
Just deploy your servlet and you are done.

If you want to run the -bin.zip (Jetty) distribution of GeoServer, I
recommend writing a systemd unit. It is so easy I wrote one in
minutes. In my view this is much easier than hacking an initscript. I
am using Debian unstable so you will have to adjust for SuSE.

First make sure you have a suitable system user because geoserver
should not run as root for security reasons:

On Debian/Ubuntu:

adduser --system geoserver

On SuSE/RedHat/CentOS:

useradd -r geoserver

I unzipped geoserver-2.7.5-bin.zip in /opt. Again, you can put this
wherever you like.

Now give the geoserver user ownership of the modifiable parts of the
installation:

chown -R geoserver /opt/geoserver-2.7.5/etc/data_dir
/opt/geoserver-2.7.5/etc/logs

You might also need to fix permissions so the geoserver user can read
all files:

chmod -R o+rX /opt/geoserver-2.7.5

Here is the systemd unit. You can put it anywhere you like and
systemctl will manage symlinks to it. You will need to adjust the
paths for your system, and add After items if you have things like
network storage that geoserver needs.

*** begin /opt/geoserver-2.7.5/etc/geoserver.service ***

[Unit]
Description=GeoServer
After=network.target

[Service]
User=geoserver
Environment=JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
Environment=GEOSERVER_HOME=/opt/geoserver-2.7.5
ExecStart=/opt/geoserver-2.7.5/bin/startup.sh
ExecStop=/opt/geoserver-2.7.5/bin/shutdown.sh

[Install]
WantedBy=multi-user.target

*** end /opt/geoserver-2.7.5/etc/geoserver.service ***

Now enable the unit (you only have to do this once):

systemctl enable /opt/geoserver-2.7.5/etc/geoserver.service

Start the geoserver service (and this will now happen automatically at
boot time):

systemctl start geoserver.service

You should be able to see systemd logs with "journalctl -b | less".
This should be your first thing to check if geoserver does not start.
If you change the unit file you will need to run "systemctl
daemon-reload" before trying to start or stop geoserver.

You can also see all running java processes with "ps -fwwC java" and
one should be owned by your geoserver user:

UID PID PPID C STIME TTY TIME CMD
geoserv+ 12297 1 18 11:38 ? 00:00:27
/usr/lib/jvm/java-8-openjdk-amd64/bin/java -XX:MaxPermSize=128m
-DGEOSERVER_DATA_DIR=/opt/geoserver-2.7.5/data_dir
-Djava.awt.headless=true -DSTOP.PORT=8079 -DSTOP.KEY=geoserver -jar
start.jar

GeoServer should be waiting for you at:

http://localhost:8080/geoserver/

I did not test a reboot but this service should now be started at boot
time and stopped before the system is shut down or rebooted.

Kind regards,
Ben.

On 09/01/16 09:40, Ferdinand Gruber wrote:

Am 08.01.2016 um 21:37 schrieb Ferdinand Gruber:

Hi Christian,

I am using openSuse 13.2 on the server. Suse now uses systemd for
management of services.
I put the init script for suse into /etc/init.d as I mentioned below.
That seems not to be the appropriate action may be because of systemd.

Ferdinand

Am 08.01.2016 um 19:18 schrieb Christian Mueller:

Hi Ferdinand

First we have to know which Linux distribution you are using. The
start scripts differ for different distributions.

Christian

On Sun, Jan 3, 2016 at 4:14 PM, Ferdinand Gruber <fer.grub@anonymised.com>
wrote:

    How can I get the geoserver started at boot time (using systemd).

    I installed the geoserver binaries in/usr/share/geoserver and it
runs
    after starting it manually using the command

         usr/share/geoserver/bin/startup.sh

    But I want the server should start automatically at boot time.

    I tried the init script for suse I found on the geoserver doku
    web page:

http://suite.opengeo.org/docs/latest/geoserver/_downloads/geoserver_suse

    I saved this file as /etc/init.d/geoserver

    After typing

         /etc/init.d/geoserver

    I get

         redirecting to systemctl start geoserver.service

    ok, but nothing happens.

    I am not familiar with the systemd concept. Please help.

    --
    Greetings from Austria
    Ferdinand Gruber

------------------------------------------------------------------------------

    _______________________________________________
    Geoserver-users mailing list
    Geoserver-users@lists.sourceforge.net
    <mailto:Geoserver-users@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/geoserver-users

--
DI Christian Mueller MSc (GIS), MSc (IT-Security)
OSS Open Source Solutions GmbH

--
Greetings from Austria
Ferdinand Gruber

------------------------------------------------------------------------------

Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140

_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users