Saturday, October 17, 2009

Automatic start tomcat in Solaris 10 ( Not use package in solaris )

#!/bin/sh

JAVA_HOME=/usr/local/java
CATALINA_HOME=/usr/local/tomcat

export JAVA_HOME CATALINA_HOME

case "$1" in
start)
$CATALINA_HOME/bin/startup.sh
;;

restart)
$CATALINA_HOME/bin/shutdown.sh
$CATALINA_HOME/bin/startup.sh
;;

stop)
$CATALINA_HOME/bin/shutdown.sh
;;

*)
echo "Usage: tomcat stop|start|restart"
;;

esac

##### save file & chmod +x
chmod +x /etc/init.d/tomcat

##### create symbolic link
ln -s /etc/init.d/tomcat /etc/rc0.d/K01tomcat

ln -s /etc/init.d/tomcat /etc/rc2.d/K01tomcat
ln -s /etc/init.d/tomcat /etc/rc2.d/S90tomcat

ln -s /etc/init.d/tomcat /etc/rc3.d/K01tomcat
ln -s /etc/init.d/tomcat /etc/rc3.d/S90tomcat


-- TaTsHuYa --

No comments: