Search This Blog

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

Ubuntu Linux 16.04 systemd unit file for Mediaflux server

[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]
# IMPORTANT: The following line is to insert the service to the dependency tree. Otherwise, it will not be called on system reboot.
WantedBy=multi-user.target

see also

Mac OS X: extra output message when exiting Terminal

After upgrade to Mac OS X El Captain, when exiting from Terminal, I see the following message: According to this, it is not to be worried.