通过/etc/rc.local实现开机自动拉起服务
来源:互联网 发布:全民淘宝客 编辑:程序博客网 时间:2024/06/05 05:35
添加服务到/etc/rc.local
如自动拉起apache服务:
服务是关闭的
开机后http进程已经启动:
对于有些服务最好在启动前先停止服务,因为有些服务进程有LOCK文件,如果异常停机后LOCK文件没有删除,在随机启动的时候会报服务已启动,通过在启动前先停止服务开消除LOCK文件来正常启动服务
如:
如自动拉起apache服务:
/etc/rc.local:
#!/bin/sh## This script will be executed *after* all the other init scripts.# You can put your own initialization stuff in here if you don't# want to do the full Sys V style init stuff.touch /var/lock/subsys/local/usr/sbin/apachectl start
服务是关闭的
[root@limt ~]# chkconfig --list|grep httphttpd 0:关闭 1:关闭 2:关闭 3:关闭 4:关闭 5:关闭 6:关闭[root@limt httpd]# rebootBroadcast message from root@limt (/dev/pts/1) at 21:25 ...The system is going down for reboot NOW!
开机后http进程已经启动:
[root@limt ~]# ps -ef|grep httproot 2907 1 0 21:29 ? 00:00:00 /usr/sbin/nss_pcache 163842 off /etc/httpd/aliasroot 2909 1 0 21:29 ? 00:00:00 /usr/sbin/httpd -k startroot 2984 2909 0 21:29 ? 00:00:00 /usr/bin/crlhelper 196611 2909 /etc/httpd/aliasapache 2987 2909 0 21:29 ? 00:00:00 /usr/sbin/httpd -k startapache 2988 2909 0 21:29 ? 00:00:00 /usr/sbin/httpd -k startapache 2989 2909 0 21:30 ? 00:00:00 /usr/sbin/httpd -k startapache 2990 2909 0 21:30 ? 00:00:00 /usr/sbin/httpd -k startapache 2991 2909 0 21:30 ? 00:00:00 /usr/sbin/httpd -k startapache 2992 2909 0 21:30 ? 00:00:00 /usr/sbin/httpd -k startapache 2993 2909 0 21:30 ? 00:00:00 /usr/sbin/httpd -k startapache 2994 2909 0 21:30 ? 00:00:00 /usr/sbin/httpd -k startapache 2995 2909 0 21:30 ? 00:00:00 /usr/sbin/httpd -k start
对于有些服务最好在启动前先停止服务,因为有些服务进程有LOCK文件,如果异常停机后LOCK文件没有删除,在随机启动的时候会报服务已启动,通过在启动前先停止服务开消除LOCK文件来正常启动服务
如:
#!/bin/sh## This script will be executed *after* all the other init scripts.# You can put your own initialization stuff in here if you don't# want to do the full Sys V style init stuff.touch /var/lock/subsys/local/usr/sbin/apachectl stop/usr/sbin/apachectl start
0 0
- 通过/etc/rc.local实现开机自动拉起服务
- 开机启动服务chkconfig开机启动脚本/etc/rc.local
- /etc/rc.d/rc.local linux启动自动开启某些服务
- /etc/rc.d/rc.local linux启动自动开启某些服务
- /etc/rc.d/rc.local linux启动自动开启某些服务
- CentOS开机启动 /etc/rc.d/rc.local
- /etc/rc.d/rc.local 自动加载linux 脚本
- ubuntu-16 开机服务rc.local
- 开机启动/etc/rc.local失效无效怎么办?解决方法
- centos7 的/etc/rc.local不会开机执行
- centos7 开机/etc/rc.local 不执行的问题
- centos7 开机/etc/rc.local 不执行的问题
- centos7 开机/etc/rc.local 不执行的问题
- centos7 开机/etc/rc.local 不执行的问题
- centos7/etc/rc.local不开机自启
- 解决centos7 开机/etc/rc.local 不执行的问题
- CentOS7 的/etc/rc.local不会开机执行解决方案
- centos开机自动启动SVN服务的方法1、编辑rc.local文件
- NYOJ 14 会场安排问题
- uva 127 ``Accordian'' Patience
- 最大子序列和问题(4种方法,按时间复杂度)
- nyoj 991 registeration system
- 谈头文件的嵌套
- 通过/etc/rc.local实现开机自动拉起服务
- 一个电影的时间掌握Awk(Linux)文本处理脚本语言
- 【web++_第三阶_博文集合_SpringMVC权限、新闻系统_2014.12.25_第一篇】
- 机器学习中样本N和hypothesis(H)个数的关系
- Linux系统的进程通常有以下几种状态
- 数据库课程设计--“茶咖啡”销售管理系统总结
- 音视频处理->音频格式简介
- 【转】c#中ListView控件加入ComboBox
- libcurl删除HTTP头部方法