1. Confluence Docs 3.0 : Start Confluence automatically on Linux & Unix This page last changed on Sep 07, 2009 by ggaskell. On Unix/Linux, the best practice is to install, configure and run each service (including Confluence) as a dedicated user with only the permissions they require. To install, configure and run Confluence automatically on Unix/Linux: Create a `confluence` user for instance, using the following command:
       sudo useradd --create-home -c "Confluence role account" confluence
2. Create a directory to install Confluence into:
       sudo mkdir /usr/local/confluence
       sudo chown confluence: /usr/local/confluence
3. Log in as the `confluence` user to install Confluence:
       sudo su - confluence
       cd /usr/local/confluence/
       tar zxvf /tmp/confluence-3.0.1-std.tar.gz
       ln -s confluence-3.0.1-std/ current
       # Edit current/confluence/WEB-INF/classes/confluence-init.properties, and set confluence.home=/usr/local/confluence/home
4. Then back as root, create the file `/etc/init.d/confluence` (code shown below), which will be responsible for starting up Confluence after a reboot (or when manually invoked). If you are running Ubuntu Jaunty (or later) do not perform this step. Please use the instructions further down this page.
       #!/bin/bash
       # Confluence startup script
       #chkconfig: 2345 80 05
       #description: Confluence

       # 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
5. Make this file executable:
       sudo chmod +x /etc/init.d/confluence
7. Set this file to run at the appropriate runleve. For example, 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 output typically 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.
1. You should then see this running at http://<server>:8080/. #### Adding Confluence as a service for Ubuntu Jaunty (or later) To continue configuring Confluence to start automatically as a service on Ubuntu Jaunty (or later): After logging in as the `confluence` user to install Confluence, create `start` and `stop` scripts in `/usr/local/confluence`: Example `start` script:
       #!/bin/bash
       export JAVA_HOME=/usr/lib/jvm/java-6-sun-1.6.0.16/
       export JDK_HOME=/usr/lib/jvm/java-6-sun-1.6.0.16/
       cd /usr/local/confluence/current/bin
       ./startup.sh
   Example `stop` script:
       #!/bin/bash
       export JAVA_HOME=/usr/lib/jvm/java-6-sun-1.6.0.16/
       export JDK_HOME=/usr/lib/jvm/java-6-sun-1.6.0.16/
       cd /usr/local/confluence/current/bin
       ./shutdown.sh
3. Make both of these scripts executable. For example, by issuing the command: `sudo chmod a+x /usr/local/confluence/start /usr/local/confluence/stop`. Create two text files in `/etc/event.d/` called `confluence-up` and `confluence-down`: `confluence-up`:
       start on runlevel 2
       start on runlevel 3
       start on runlevel 4
       start on runlevel 5

       exec sudo -u confluence /usr/local/confluence/start >> /tmp/confluence-startup.out 2>&1
   `confluence-down`:
       start on runlevel 1
       start on runlevel 6

       exec sudo -u confluence /usr/local/confluence/stop >> /tmp/confluence-shutdown.out 2>&1
##### RELATED TOPICS Start Confluence automatically on system startup

Document generated by Confluence on Nov 05, 2009 23:34