Sunday, October 24, 2010

LifeRay - Init.d Script

Example of my init.d LifeRay startup script (Debian).

#!/bin/bash
# description: LifeRay Start|Stop|Restart
export PATH
export JAVA_HOME=/usr/lib/jvm/java-6-sun-1.6.0.20/
export CLASSPATH=//usr/lib/jvm/java-6-sun-1.6.0.20/lib/tools.jar:/usr/lib/jvm/java-6-sun-1.6.0.20/jre/lib/rt.jar:./
export CATALINA_HOME=/usr/local/liferay/tomcat

start()
        {
        cd $CATALINA_HOME/bin
        sh startup.sh
        }

stop()
        {
        cd $CATALINA_HOME/bin
        sh shutdown.sh
        }

case "$1" in
start) 
        start
        ;;
stop)
        stop
        ;;
restart)
        stop
        start
        ;;
*)
echo "start|stop|restart"
esac

I saved this into /etc/init.d/ as the name liferay, then updated the run levels.

update-rc.d liferay defaults

No comments: