首页>>帮助中心>>云服务器centos服务的管理

云服务器centos服务的管理

2024/1/31 135次
 服务的管理


 方法一:手动进行运行

 运行: /usr/sbin/httpd

 停止: killall httpd

    方法二:采用systemd方式运行  

 用户--     systemctl命令    -->systemd--配置文件-->httpd程序运行

 –服务启动配置文件目录:/lib/systemd/system/

 •上帝进程:systemd

 •Linux系统和服务管理器

 –是内核引导之后加载的     第一个初始化进程    (PID=1)

 –负责掌控整个Linux的运行/服务资源组合

 •一个更     高效    的系统&服务管理器

 –开机服务     并行启动    ,各系统服务间的精确依赖

 –服务目录:/lib/systemd/system/

 –主要管理工具:systemctl

 [root@server ~]# systemctl -t service --all #列出所有的服务

 •对于服务的管理(与手动启动有冲突)

 方法二:采用systemd方式运行

 用户--     systemctl命令    -->systemd--配置文件-->httpd程序运行

 –服务配置文件目录:/lib/systemd/system/

    systemctl restart 服务名    #重起服务

 systemctl start 服务名 #开启服务

 systemctl stop 服务名 #停止服务

 systemctl status 服务名 #查看服务当前的状态

    systemctl enable 服务名    #设置服务开机自启动

 systemctl disable 服务名 #设置服务禁止开机自启动

 systemctl is-enabled 服务名 #查看服务是否开机自启

 ]#     yum -y install httpd  

 ]#     killall httpd    #杀死手动启动的httpd

 ]#     systemctl restart httpd    #重启httpd服务

 ]#     systemctl status httpd    #查看服务httpd状态

 ]#     systemctl enable httpd    #设置httpd开机自启动

 Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.

 ]#     systemctl is-enabled httpd    #查看httpd是否是开机自启动

 ]#     systemctl disable httpd    #关闭httpd开机自启动

 Removed symlink /etc/systemd/system/multi-user.target.wants/httpd.service.

 ]#     systemctl is-enabled httpd    #查看httpd是否是开机自启动

版权声明

    声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们996811936@qq.com进行处理。