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:
        # 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

No comments:

Post a Comment