[Unit]
Description=OMERO.server
# After: ensures this service starts after the dependency, but only if the
# dependency is also started (PostgreSQL may be on a different server)
After=postgresql-9.4.service
After=postgresql-9.5.service
After=postgresql-9.6.service
After=postgresql-10.service
After=postgresql-11.service
After=network.service

[Service]
User=omero-server
WorkingDirectory=/opt/omero
Type=forking
Restart=no
RestartSec=10
# Allow up to 5 min for start/stop
TimeoutSec=300
Environment="PATH=/opt/ice-3.6.5/bin:/opt/omero/server/venv3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin"
Environment="OMERODIR=/opt/omero/server/OMERO.server"
ExecStart=/opt/omero/server/venv3/bin/omero admin start
ExecStop=/opt/omero/server/venv3/bin/omero admin stop
# If you want to enable in-place imports uncomment this:
#UMask=0002

[Install]
WantedBy=multi-user.target
