Tomcat
1.创建脚本
脚本中chkconfig后面的2345表示Linux启动等级,10和90表示开机启动和关机停止的优先级,数值越小,触发越早
-
#! /bin/bash
-
#chkconfig:2345 10 90
-
#description:Start or Stop Tomcat Service
-
case $1 in
-
start)
-
echo "Starting Tomcat Service"
-
su - lihuilin -c "/software/apache-tomcat-7.0.47/bin/catalina.sh start">>/dev/null
-
;;
-
stop)
-
echo "Stoping Tomcat Service"
-
su - lihuilin -c "/software/apache-tomcat-7.0.47/bin/catalina.sh stop">>/dev/null
-
;;
-
restart)
-
echo "Restarting Tomcat Service"
-
su - lihuilin -c "/software/apache-tomcat-7.0.47/bin/catalina.sh stop">>/dev/null
-
su - lihuilin -c "/software/apache-tomcat-7.0.47/bin/catalina.sh start">>/dev/null
-
;;
-
*)
-
echo $"Usage: tomcat {start|stop|restart}"
-
esac
2.添加服务
将脚本移动至/etc/init.d/目录下,将其添加为服务
-
[root@lihuilin init.d]# chkconfig --add tomcat
-
[root@lihuilin init.d]# chkconfig tomcat on
-
[root@lihuilin init.d]# service tomcat start
Oracle
1.修改/etc/oratab
将oratab的内容orcl:/software/app/lihuilin/product/11.2.0/dbhome_1:N
改为orcl:/software/app/lihuilin/product/11.2.0/dbhome_1:Y
这样Oracle的dbstart和dbshut命令就可以使用了。
需要修改日志的读写权限
2.创建脚本和服务
-
#!/bin/bash
-
#chkconfig:2345 10 90
-
#description:Start or Stop Oracle Service
-
case $1 in
-
start)
-
echo "Starting Oracle Service"
-
su - lihuilin -c "/software/app/lihuilin/product/11.2.0/dbhome_1/bin/lsnrctl start">>/dev/null
-
su - lihuilin -c "/software/app/lihuilin/product/11.2.0/dbhome_1/bin/dbstart">>/dev/null
-
;;
-
stop)
-
echo "Stoping Oracle Service"
-
su - lihuilin -c "/software/app/lihuilin/product/11.2.0/dbhome_1/bin/lsnrctl stop">>/dev/null
-
su - lihuilin -c "/software/app/lihuilin/product/11.2.0/dbhome_1/bin/dbshut">>/dev/null
-
;;
-
*)
-
echo $"Usage: oracle {start|stop}"
-
esac
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29254281/viewspace-1063036/
,如需转载,请注明出处,否则将追究法律责任。