centos自动启动

2017.12.6 centos

一.添加Oracle自动启动

#!/bin/sh nohup /usr/local/nginx/sbin/nginx su - oracle «EON export ORACLE_SID=qibu lsnrctl start sqlplus /nolog «EOF conn / as sysdba startup exit EOF exit EON

echo “/home/oracle/Start_ORA.sh”»/etc/rc.local

二.tomcat自动启动

centos 下tomcat 自动启动 http://www.cnblogs.com/zlfoak/p/5247942.html Centos 配置tomcat 自动启动 http://qieyi28.iteye.com/blog/2370112

1、修改startup.sh文件 vim /app/apache-tomcat/bin/startup.sh

在文件头增加以下内容:

#!/bin/sh

chkconfig: 2345 97 00

description:tomcat auto start

#processname: tomcat

2、创建链接文件

ln -s /app/apache-tomcat/bin/startup.sh /etc/init.d/tomcat

3、添加启动

chkconfig –add tomcat(add前是两个减号)

chkconfig tomcat on

4、 vi catalina.sh 在85行添加如下代码: export JAVA_HOME=/app/jdk1.8.0_73 export JRE_HOME=/app/java/jre1.8-x64 export CATALINA_HOME=/app/apache-tomcat export CATALINA_BASE=/app/apache-tomcat export CATALINA_TMPDIR=/app/apache-tomcat/temp

5、检查

service tomcat start

三.nginx自动启动

centos 6,7 配置nginx服务、开机自动启动 https://my.oschina.net/taoluoluo/blog/749134

添加nginx自动启动

1.添加文件 vim /etc/init.d/nginx

2.内容 #!/bin/bash

nginx Startup script for the Nginx HTTP Server

it is v.0.0.2 version.

chkconfig: - 85 15

description: Nginx is a high-performance web and proxy server.

It has a lot of features, but it’s not for everyone.

processname: nginx

pidfile: /var/run/nginx.pid

config: /usr/local/nginx/conf/nginx.conf

nginxd=/usr/local/nginx/sbin/nginx nginx_config=/usr/local/nginx/conf/nginx.conf nginx_pid=/var/run/nginx.pid RETVAL=0 prog=”nginx”

Source function library.

. /etc/rc.d/init.d/functions

Source networking configuration.

. /etc/sysconfig/network

Check that networking is up.

[ ${NETWORKING} = “no” ] && exit 0 [ -x $nginxd ] || exit 0

Start nginx daemons functions.

start() { if [ -e $nginx_pid ];then echo “nginx already running….” exit 1 fi echo -n $”Starting $prog: “ daemon $nginxd -c ${nginx_config} RETVAL=$? echo [ $RETVAL = 0 ] && touch /var/lock/subsys/nginx return $RETVAL }

Stop nginx daemons functions.

stop() { echo -n $”Stopping $prog: “ killproc $nginxd RETVAL=$? echo [ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /var/run/nginx.pid }

reload nginx service functions.

reload() { echo -n $”Reloading $prog: “ #kill -HUP cat ${nginx_pid} killproc $nginxd -HUP RETVAL=$? echo }

See how we were called.

case “$1” in start) start ;; stop) stop ;; reload) reload ;; restart) stop start ;; status) status $prog RETVAL=$? ;; *) echo $”Usage: $prog {start|stop|restart|reload|status|help}” exit 1 esac exit $RETVAL

3.设置自启

#添加服务 chkconfig –add nginx chkconfig nginx on

4.启动服务 service nginx start

Oracle数据库自动启动Shell脚本 http://www.360doc.com/content/12/0907/17/7909375_234860254.shtml https://www.2cto.com/os/201109/105743.html

更新列表:

*

参考文章:

[1]:

相关阅读