歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux綜合 >> 學習Linux >> systemctl & systemd的相關資料整理

systemctl & systemd的相關資料整理

日期:2017/3/6 9:26:44   编辑:學習Linux

systemctl & systemd的相關資料整理


systemctl & systemd的相關資料整理


systemctl & systemd的相關資料整理

1、腳本目錄:
/usr/lib/systemd/
2、服務配置文件目錄(開機自啟動):
/usr/lib/systemd/system
3、服務文件
服務格式:
*.service
服務文件格式:
[Unit] //用戶服務說明
Description=xxx //描述服務
After=xxx //描述服務類別
[Service] //服務具體運行參數
Type=forking //服務後台運行
PIDFile=/path/pid //PID的路徑
ExecStart= //服務運行的命令與參數(絕對路徑)
ExecReload= //服務重啟的命令與參數(絕對路徑)
ExecStop= //服務停止運行的命令與參數(絕對路徑)
PrivateTmp=True //為服務分配獨立的臨時空間
[Install] //服務安裝的配置

4、服務使用方法

systemctl start [服務文件名]
systemctl restart [服務文件名]
systemctl stop [服務文件名]
systemctl status [服務文件名]

5、相關命令
任務 舊指令 新指令
使某服務自動啟動 chkconfig --level 3 httpd on systemctl enable httpd.service
使某服務不自動啟動 chkconfig --level 3 httpd off systemctl disable httpd.service
檢查服務狀態 service httpd status systemctl status httpd.service (服務詳細信息) systemctl is-active httpd.service (僅顯示是否 Active)
顯示所有已啟動的服務 chkconfig --list systemctl list-units --type=service
啟動某服務 service httpd start systemctl start httpd.service
停止某服務 service httpd stop systemctl stop httpd.service
重啟某服務 service httpd restart systemctl restart httpd.service

參閱原文:

systemctl使用指南:CentOS 7.x systemd對比CentOS 6.x daemon

systemctl 命令完全指南

CentOS 7 上systemctl 的用法

本文永久更新鏈接地址:

http://xxxxxx/Linuxjc/1145173.html TechArticle

Copyright © Linux教程網 All Rights Reserved