CentOS程序 开机启动设置与chkconfig命令学习
2015-09-25 14:30
796 查看
CentOS设置程序开机启动的方法:
1.启动命令添加到/etc/rc.d/rc.local 文件中, 如:vim /etc/rc.d/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 #后面添加要开机启动的程序命令如httpd /usr/local/apache/bin/apachectl start
2.把写好的启动脚本添加到目录/etc/rc.d/init.d/,然后使用命令chkconfig设置开机启动。
#把httpd的脚本写好后放进/etc/rc.d/init.d/目录 chkconfig --add httpd #增加所指定的系统服务 chkconfig httpd on
三.chkconfig命令
chkconfig:更新(启动或停止)和查询运行级别(runlevel)信息对于系统服务.
语法如下:
chkconfig --list [name]:显示所有运行级系统服务的运行状态信息(on或off)。如果指定了name,那么只显示指定的服务在不同运行级的状态。
chkconfig --add name:增加一项新的服务。chkconfig确保每个运行级有一项启动(S)或者杀死(K)入口。如有缺少,则会从缺省的init脚本自动建立。
chkconfig --del name:删除服务,并把相关符号连接从/etc/rc[0-6].d删除
chkconfig [--level levels] name <on|off|reset>:指定读系统服务要在哪一个执行等级中开启或关毕。
chkconfig --level httpd 2345 on #设置httpd在运行级别为2、3、4、5的情况下都是on(开启)的状态 chkconfig --level 35 mysqld on #设定mysqld在等级3和5为开机运行服务,--level 35表示操作只在等级3和5执行,on表示启动,off表示关闭 chkconfig mysqld on #设定mysqld在各等级为on,“各等级”包括2、3、4、5等级
chkconfig [--level levels] name:
相关文章推荐
- Linux中搭建FTP服务器的方法
- Linux目录树:根目录、典型目录等详细说明
- 13个实用的Linux find命令示例
- Linux命令英文全称
- linux权限和用户管理
- Linux-CentOS 安装配置swftools
- Linux 目录结构
- Centos 7.1下如何安装cobbler
- linux--posix多线程编程----第一篇
- linux(php)
- Linux应用总结(1):自动删除n天前日志
- Linux GCC常用命令
- linux服务进程管理
- linux之route命令
- 每天一个linux命令目录
- linux进程管理
- windows7共享文件给vmware虚拟机中的Linux系统教程
- LINUX下WIFI默认连接
- linux下mysql的root密码忘记解决方案
- Linux挂载Winodws共享文件夹【转】