Search This Blog

OMERO systemd units

  • Systemd unit for OMERO.server:
    cat /lib/systemd/system/omero.service
    [Unit]
    Description=OMERO Server
    Wants=remote-fs.target postgresql.service
    After=remote-fs.target postgresql.service
       
    [Service]
    Type=forking
    ExecStart=/etc/init.d/omero start
    ExecStop=/etc/init.d/omero stop
    
    [Install]
    WantedBy=multi-user.target
    
  • Systemd unit for OMERO.web:
    cat /lib/systemd/system/omero-web.service
    [Unit]
    Description=OMERO web
    Wants=nginx.service omero.service
    After=nginx.service omero.service
       
    [Service]
    Type=forking
    ExecStart=/etc/init.d/omero-web start
    ExecStop=/etc/init.d/omero-web stop
    
    [Install]
    WantedBy=multi-user.target
    

OMERO.web startup script /etc/init.d/omero-web

OMERO.server startup script /etc/init.d/omero

Mediaflux startup script to run the server as non-root user

  • The configuration file should be saved to /etc/mediaflux:
    export MFLUX_HOME=/opt/mediaflux
    export MFLUX_DOMAIN=system
    export MFLUX_USER=manager
    export MFLUX_TRANSPORT=https
    export MFLUX_PORT=8443
    export MFLUX_UMASK=0007
    export MFLUX_ADMIN=mflux
    
  • The startup script modified from $MFLUX_HOME/bin/unix/mediaflux should be saved to /etc/init.d/mediaflux
    • sudo cp $MFLUX_HOME/bin/unix/mediaflux /etc/init.d/mediaflux
    • sudo vi /etc/init.d/mediaflux
      • Note: the following changes is required by systemd on Ubuntu Linux 16.04:
        #!/bin/bash
        # Required-Start:    $remote_fs $syslog
        # Required-Stop:     $remote_fs $syslog
        # Default-Start:  2 3 4 5
        # Default-Stop: 0 1 6
        
      • Note: the following changes is to run the sevice as user mflux rather than root:
        start-stop-daemon --start --background --umask $MFLUX_UMASK -c $MFLUX_ADMIN --exec "${JAVA}" -- -jar $MFLUX_HOME/bin/aserver.jar application.home=$MFLUX_HOME nogui $DEBUG >> $MFLUX_HOME/volatile/logs/unix_start.log&

see also

Start Mediaflux server on system reboot using systemd on Ubuntu Linux 16.04

  1. Modify mediaflux script file from $MFLUX_HOME/bin/unix/mediaflux and install it to /etc/init.d/mediaflux.
  2. create systemd unit file at /lib/systemd/system/mediaflux.service
    [Unit]
    Description=Mediaflux Server
    After=remote-fs.target
       
    [Service]
    Type=forking
    ExecStart=/etc/init.d/mediaflux start
    ExecStop=/etc/init.d/mediaflux force-stop
    
    [Install]
    WantedBy=multi-user.target
    
  3. Enable the systemd unit (so that it is called on reboot)
    sudo systemctl enable mediaflux.service
  4. Start the service manually(without reboot)
    sudo systemctl start mediaflux.service

see also