centos7サービス管理systemctl

LinuxのSystemctlは、System V、サービスとchkconfigコマンドを置き換えるために、システム管理デーモン、ツールとライブラリのコレクションです、最初のプロセスがsystemdにシステムとサービスマネージャを制御するための主に担当しています。Systemctlことによって、あなたはコマンドが分かれていることがわかります-help:クエリまたは関連サービスコマンド管理部サービス、ファイルサービス、タスク、環境、systemdにサービスの過負荷を設定するには、スナップショット関連のコマンドをsystemdにするために、システムを制御コマンドを送信します関連するコマンドをオフに起動します。
 
1つのスタート、再起動、停止および再ロード、サービス(例えばhttpd.service)状態をチェックします
httpd.serviceを開始systemctl
systemctl再起動httpd.service
systemctl停止httpd.service
systemctlリロードhttpd.service
systemctl状況httpd.service
注意:私たちは、開始、再起動systemctl使用する場合は、停止して、コマンドを再ロードすると、端末は何も出力、ステータスコマンドは、出力のみを印刷することができます。
 
サービスをアクティブにし、起動時にサービスを有効または無効にする方法2.(つまり、システムは起動時に自動的にmysql.serviceサービスを開始します)
systemctlは、アクティブmysql.service
mysql.serviceを有効systemctl
systemctl無効mysql.service
 
(例えばntpdate.serviceなど)3.どのようにシールド(それが起動することはできません)またはディスプレイサービス
systemctlマスクntpdate.service
LN -sを/ dev / null /etc/systemd/system/ntpdate.service
systemctlアンマスクntpdate.service
RMの/etc/systemd/system/ntpdate.service
 
4.リストのすべてのサービスを
systemctl list-unit-files –type=service
 
5. 检查某个单元(如 crond.service)是否启用
systemctl is-enabled crond.service
 
6. 列出所有失败单元
systemctl –failed
 
7. 列出所有运行中单元
systemctl list-units
 
8. 列出所有可用单元
systemctl list-unit-files
 
9. 使用systemctl命令杀死服务
systemctl kill crond
 
10. 列出所有系统挂载点
systemctl list-unit-files –type=mount
 
11. 挂载、卸载、重新挂载、重载系统挂载点并检查系统中挂载点状态
systemctl start tmp.mount
systemctl stop tmp.mount
systemctl restart tmp.mount
systemctl reload tmp.mount
systemctl status tmp.mount
 
12. 在启动时激活、启用或禁用挂载点(系统启动时自动挂载)
systemctl is-active tmp.mount
systemctl enable tmp.mount
systemctl disable tmp.mount
 
13. 在Linux中屏蔽(让它不能启用)或可见挂载点
systemctl mask tmp.mount
ln -s /dev/null /etc/systemd/system/tmp.mount
systemctl unmask tmp.mount
rm /etc/systemd/system/tmp.mount
 
14. 列出所有可用系统套接口
systemctl list-unit-files –type=socket
 
15. 检查某个服务的所有配置细节
systemctl show mysql
 
16. 获取某个服务(httpd)的依赖性列表
systemctl list-dependencies httpd.service
 
17. 启动救援模式
systemctl rescue
 
18. 进入紧急模式
systemctl emergency
 
19. 列出当前使用的运行等级
systemctl get-default
 
20. 启动运行等级5,即图形模式
systemctl isolate runlevel5.target
或systemctl isolate graphical.target
 
21. 启动运行等级3,即多用户模式(命令行)
systemctl isolate runlevel3.target
或systemctl isolate multiuser.target
 
22. 设置多用户模式或图形模式为默认运行等级
systemctl set-default runlevel3.target
systemctl set-default runlevel5.target
 
23. 重启、停止、挂起、休眠系统或使系统进入混合睡眠
systemctl reboot
systemctl halt
systemctl suspend
systemctl hibernate
systemctl hybrid-sleep

おすすめ

転載: www.cnblogs.com/xyz999/p/11716445.html