Linux 下自动运行 Tomcat
#!/bin/bash
#
# lixiangyi
#
# chkconfig: 3456 11 91
# description:
# Source function library.
. /etc/rc.d/init.d/functions
prog="jeeyin_web"
start() {
??????? # Start daemons.
?echo -n $"Starting $prog: "
?/usr/javaweb/tomcat6/bin/startup.sh
}
stop() {
??????? # Stop daemons.
?echo -n $"Stopping $prog: "
?/usr/javaweb/tomcat6/bin/shutdown.sh
}
case "$1" in
?start)
??start
??;;
?stop)
??stop
??;;
?*)
??????? ?echo $"Usage: $0 {start|stop}"
??exit 1
esac
exit $?
?
?
1 保存添加可执行
chmod a+x /etc/rc.d/init.d/tomcatd
?
2 加入启动项
chkconfig --add tomcatd
?? 查看一下
chkconfig --list tomcatd
?
3 启动项目添加连接方式(*如果执行前两项还不成功的话,可执行步骤三)
/etc/rc3.d/??目录下创建 ln -s ../init.d/tomcatd? ./S15TOMCAT
/etc/rc5.d/??目录下创建 ln -s ../init.d/tomcatd? ./S15TOMCAT
?
4 reboot linux