Server

Configuring the Nuxeo Platform as a Daemon with SysVinit

Updated: December 17, 2024

The procedure described here is targeted for the Debian Wheezy distribution, and should be valid for any Debian-based GNU/Linux distribution such as Ubuntu. In other GNU/Linux distributions some commands may be different.

Here is a sample script based on the one used in the Debian package.

/etc/init.d/nuxeo

#!/bin/sh
### BEGIN INIT INFO
# Provides:          nuxeo
# Required-Start:    $local_fs $remote_fs $network $syslog
# Required-Stop:     $local_fs $remote_fs $network $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start/stop Nuxeo
### END INIT INFO

DESC="Nuxeo"

NUXEO_USER=nuxeo
NUXEOCTL="/var/lib/nuxeo/server/bin/nuxeoctl"
NUXEO_CONF="/etc/nuxeo/nuxeo.conf"
export NUXEO_CONF

. /lib/init/vars.sh
. /lib/lsb/init-functions

create_pid_dir() {
    mkdir -p /var/run/nuxeo
    chown $NUXEO_USER:$NUXEO_USER /var/run/nuxeo
}

# Change ulimit to minimum needed by Nuxeo
ulimit -n 2048

case "$1" in
  start)
        log_daemon_msg "Starting" "$DESC\n"
        create_pid_dir
        su $NUXEO_USER -c "$NUXEOCTL --quiet startbg"
        ES=$?
        log_end_msg $ES
        ;;
  stop)
        log_daemon_msg "Stopping" "$DESC\n"
        su $NUXEO_USER -c "$NUXEOCTL --quiet stop"
        ES=$?
        log_end_msg $ES
        ;;
  restart)
        create_pid_dir
        su $NUXEO_USER -c "$NUXEOCTL --quiet restart"
        ES=$?
        log_end_msg $ES
        ;;
  force-reload)
        create_pid_dir
        su $NUXEO_USER -c "$NUXEOCTL --quiet restart"
        ES=$?
        log_end_msg $ES
        ;;
  status)
        su $NUXEO_USER -c "$NUXEOCTL --quiet status"
        exit $?
        ;;
  *)
        echo "Usage: $0 {start|stop|restart|force-reload|status}" >&2
        exit 3
        ;;
esac

  1. Copy the shell script to /etc/init.d/nuxeo, replacing paths to match your installation.
  2. Enable the autostart creating the links in the rcX.d directories running the command (as root):

    $ update-rc.d nuxeo defaults
    
    
  3. Restart the machine and verify that the Nuxeo Platform is started automatically looking at the log file.

If you want to remove the automatic startup use the command (as root):

$ update-rc.d -f nuxeo remove

You can manage the service with the following command:

/etc/init.d/nuxeo [status|start|stop|...]

Other Linux-Related Documentation