Loading

Linux 服务管理

查看运行级别:runlevel
修改运行级别: init 运行级别
默认运行级别: vim /etc/inittab
服务自启动:指让服务在系统开机后随之启动服务
查看服务自启动状态:chkconfig --list
源码包服务安装位置:/usr/local
查看进程:ps aux
列出已启动的服务:netstat -ntlpu
-t 列出tcp数据
-u 列出udp数据
-l 列出正在监听的网络服务
-n 用端口号来显示服务而不是服务名
-p 列出该服务的进程ID

启动脚本位置:/etc/init.d/
配置文件位置:/etc/
初始化环境配置文件位置:/etc/sysconfig/
日志:/var/log/
服务产生的数据放在这里:/var/lib/

/etc/init.d/独立服务名 start
service 独立服务名 start

源码包服务自启动:vim /etc/rc.d/rc.local 加入 /usr/local/apache2/bin/apachectl start

让源码包服务被服务管理命令识别:
ln -s /usr/local/apache2/bin/apachectl /etc/init.d/apache

源码包服务被chkconfig识别:
vim /etc/init.d/apache
# chkconfig:35 86 76
# 指定httpd脚本可以被chkconfig命令管理。chkconfig: 运行级别 启动顺序 关闭顺序
# description: source package apache

posted @ 2022-11-12 22:39  三淼  阅读(41)  评论(0编辑  收藏  举报