Starting and Stopping Alfresco

Document created by resplin Employee on Jun 6, 2015
Version 1Show Document
  • View in full screen mode

Obsolete Pages{{Obsolete}}

The official documentation is at: http://docs.alfresco.com



AdministrationInstallation

Alfresco comes with startup scripts for Microsoft Windows and *nix that should work for most people in simple configurations.  If you use the Web Content Management features that require the Alfresco Virtualization Server, then similar scripts are also provided to start and stop it.


Microsoft Windows


The Alfresco bundles provide a .bat script called alf_start.bat and alf_stop.bat to start and stop the Alfresco server.  These in turn call the alfresco.bat script.


Linux and Unix


The Alfresco bundles provide a shell script called alfresco.sh in the main Alfresco directory. To start or stop Alfresco, call the script with start or stop.

For example:  ./alfresco.sh start &

The '&' symbol throws the process into the background.



If you have multiple instances you can start each instance independently (if you are running Jboss) by running
run.sh -c (instance name) located in the Jboss/bin directory

For example:  ./run.sh -c instance2 &

To shutdown the specific instance you will need to know the JNP port that the instance is using to
shutdown the instance by using shutdown.sh also located in the Jboss/bin directory.

For example:  ./shutdown.sh -s jnp://localhost:1199

Where 1199 is the jnp port.








Here's a working init.d script I'm using on a RHEL 5.3 server, of course update the variables to match your environment:



#!/bin/bash
#
# alfresco      Startup script for Alfresco
#
# chkconfig: 345 96 14
# description: Starts up the Alfresco ECM engine
# processname: alfresco
# pidfile: $ALF_HOME/alfresco.pid
#

    # User under which tomcat will run
    JAVA_HOME=/usr/java/default
    ALF_HOME=/www/web/dev1/alfresco
    ALF_SCRIPT=$ALF_HOME/alfresco.sh

    RETVAL=0

    # start, debug, stop, and status functions
    start() {
        # Start Tomcat in normal mode
        SHUTDOWN_PORT=`netstat -vatn|grep LISTEN|grep 8005|wc -l`
        export JAVA_HOME=$JAVA_HOME
        if [ $SHUTDOWN_PORT -ne 0 ]; then
            echo 'Alfresco already started'
        else
            echo 'Starting alfresco...'
            $ALF_SCRIPT start
            SHUTDOWN_PORT=`netstat -vatn|grep LISTEN|grep 8005|wc -l`
            while [ $SHUTDOWN_PORT -eq 0 ]; do
                sleep 1
                SHUTDOWN_PORT=`netstat -vatn|grep LISTEN|grep 8005|wc -l`
            done
            RETVAL=$?
            echo 'Alfresco started'
            [ $RETVAL=0 ] && touch /var/lock/subsys/alfresco
        fi
    }

    stop() {
        SHUTDOWN_PORT=`netstat -vatn|grep LISTEN|grep 8005|wc -l`
        export JAVA_HOME=$JAVA_HOME
        if [ $SHUTDOWN_PORT -eq 0 ]; then
            echo 'Alfresco already stopped'
        else
            echo 'Stopping alfresco...'
            $ALF_SCRIPT stop
            SHUTDOWN_PORT=`netstat -vatn|grep LISTEN|grep 8005|wc -l`
            RETVAL=$?
            echo 'Alfresco stopped'
            [ $RETVAL=0 ] && rm -f /var/lock/subsys/alfresco $ALF_HOME/alfresco.pid
        fi
    }

    status() {
        SHUTDOWN_PORT=`netstat -vatn|grep LISTEN|grep 8005|wc -l`
        if [ $SHUTDOWN_PORT -eq 0 ]; then
            echo 'Alfresco stopped'
        else
            echo 'Alfresco running'
        fi
    }

    case '$1' in
      start)
            start
            ;;
      stop)
            stop
            ;;
      restart)
            stop
            start
            ;;
      status)
            status
            ;;
      *)
            echo 'Usage: $0 {start|stop|restart|status}'
            exit 1
    esac

    exit $RETVAL






Related Links:


Attachments

    Outcomes