设置Tomcat Jboss Oracle Mysql Linux自启动服务实例

Tomcat

1 运行脚本 自带 /usr/local/tomcat/bin/startup.sh
2 服务启动脚本
#!/bin/sh 
# whoami
# root
# chkconfig: 2345 65 37
# description: starts tomcat6
export JAVA_HOME=/usr/local/jdk1.5.0_18
export CATALINA_HOME=/usr/local/tomcat
export CATALINA_BASE=/usr/local/tomcat
CLASSPATH=.:$CLASSPATH:$JAVA_HOME/lib/rt.jar:$JAVA_HOME/lib/tools.jar:$CATALINA_HOME/bin/commons-daemon.jar:$CATALINA_HOME/bin/bootstrap.jar
case "$1" in
start)
echo "Starting tomcat6..."
$CATALINA_BASE/bin/startup.sh
;;
stop)
echo "Stopping tomcat6..."
$CATALINA_BASE/bin/shutdown.sh
;;
*)
echo "Usage tomcat.sh start/stop"
exit 1;;
esac

Jboss

1 运行脚本 自带 /usr/local/jboss/bin/run.sh
2 服务启动脚本
#!/bin/bash
# chkconfig: 2345 66 36
# description: starts jboss
export JAVA_HOME=/usr/local/jdk1.5.0_18
case "$1" in
start)
echo -n "Starting jboss: "
#start
"/usr/local/jboss/bin/run.sh" &
echo
;;

stop)
echo -n "shutting down jboss: "
#stop
"/usr/local/jboss/bin/shutdown.sh"
echo
;;

restart)
echo -n "restarting jboss: "
$0 stop
$0 start
echo
;;
*)
echo "usage: jboss { start | stop | restart }"
exit 1

esac
exit 0

Oracle

1 运行脚本

start_db.sh
#!/bin/sh
export ORACLE_SID=dbname
lsnrctl start
sqlplus "/as sysdba"<<EOF
startup

shutdown_db.sh
#!/bin/sh
export ORACLE_SID=dbname
lsnrctl stop
sqlplus "/as sysdba"<<EOF
shutdown immediate

2 服务启动脚本
#!/bin/bash
# chkconfig: 2345 66 36
# description: starts the oracle dabase deamons
case "$1" in
start)
echo -n "Starting oracle10g: "
#start
su - oracle -c "/home/oracle/script/start_db.sh"
echo
;;
stop)
echo -n "shutting down oracle10g: "
#stop
su - oracle -c "/home/oracle/script/shutdown_db.sh"
echo
;;
restart)
echo -n "restarting oracle10g: "
$0 stop
$0 start
echo
;;
*)
echo "usage: oracle10g { start | stop | restart }"
exit 1
esac
exit 0


Mysql

#> cp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d
#> mv mysql.server mysql
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值