This page last changed on Feb 26, 2008 by jeff.

On Unix, best practice is to install each service (like Confluence) running as a dedicated user who has only the required permissions. For instance, you could create a confluence user with:

sudo useradd --create-home -c "Confluence role account" confluence

Then create a directory to install Confluence into:

sudo mkdir /usr/local/confluence
sudo chown confluence: /usr/local/confluence

and log in as the confluence user to install Confluence:

sudo su - confluence
cd /usr/local/confluence/
tar zxvf /tmp/confluence-2.7.1-std.tar.gz
ln -s confluence-2.7.1-std/ current
# Edit current/confluence/WEB-INF/classes/confluence-init.properties, and set confluence.home=/usr/local/confluence/home

Then back as root, create the file /etc/init.d/confluence, which will be responsible for starting up Confluence after a reboot (or when manually invoked):

#!/bin/bash
# Confluence startup script

# Based on script at http://www.bifrost.org/problems.html

RUN_AS_USER=confluence
CATALINA_HOME=/usr/local/confluence/current

start() {
        echo "Starting Confluence: "
        if [ "x$USER" != "x$RUN_AS_USER" ]; then
          su - $RUN_AS_USER -c "$CATALINA_HOME/bin/startup.sh"
        else
          $CATALINA_HOME/bin/startup.sh
        fi
        echo "done."
}
stop() {
        echo "Shutting down Confluence: "
        if [ "x$USER" != "x$RUN_AS_USER" ]; then
          su - $RUN_AS_USER -c "$CATALINA_HOME/bin/shutdown.sh"
        else
          $CATALINA_HOME/bin/shutdown.sh
        fi
        echo "done."
}

case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart)
        stop
        sleep 10
        #echo "Hard killing any remaining threads.."
        #kill -9 `cat $CATALINA_HOME/work/catalina.pid`
        start
        ;;
  *)
        echo "Usage: $0 {start|stop|restart}"
esac

exit 0

Make sure it is executable:

sudo chmod +x /etc/init.d/confluence

and set it to run at the appropriate runlevel (use sudo ntsysv on Redhat-based systems, sudo update-rc.d confluence defaults or rcconf on Debian-based systems).

You should now be able to start Confluence with the init script. A successful startup looks like this:

$ sudo /etc/init.d/confluence start
Starting Confluence: 
If you encounter issues starting up Confluence Standalone, please see the Installation guide at http://confluence.atlassian.com/display/DOC/Confluence+Installation+Guide
Using CATALINA_BASE:   /usr/local/confluence/current
Using CATALINA_HOME:   /usr/local/confluence/current
Using CATALINA_TMPDIR: /usr/local/confluence/current/temp
Using JRE_HOME:       /usr/lib/jvm/java-1.5.0-sun
done.

You should then see it running at http://<server>:8080/.

Related Topics

Start Confluence automatically on system startup

Document generated by Confluence on Aug 07, 2008 19:08