chkconfigコマンド
主要用来更新(启动或停止)和查询系统服务(service)的运行级信息,用于维护/etc/rc[0-6].d目录的命令行工具。
chkconfig -–add httpd
增加httpd服务
chkconfig –-del httpd
删除httpd服务
chkconfig –-list
列出系统所有的服务启动情况
chkconfig –-list mysqld
列出mysqld服务设置情况
chkconfig –-level 35 mysqld on
设定mysqld在等级3和5为开机运行服务(on表示开机启动,off表示开机不启动,reset指重置服务的启动信息)
chkconfig mysqld on
设定mysqld在各等级为on,“各等级”包括2、3、4、5等级
等级0表示:表示关机
等级1表示:单用户模式
等级2表示:无网络连接的多用户命令行模式
等级3表示:有网络连接的多用户命令行模式
等级4表示:不可用
等级5表示:带图形界面的多用户模式
等级6表示:重新启动
systemctl(代わりのchkconfigやサービスの)
在 Centos 中 systemctl 是设置系统服务(service)的命令,它融合之前service和chkconfig的功能于一体。
可以使用它永久性或只在当前会话中启用/禁用服务。
启动、停止、重启、重载服务
systemctl start name.service
systemctl stop name.service
systemctl restart name.service
systemctl reload name.service
查看某个服务(单元)的状态
systemctl status name.service
激活/禁止自动启动
systemctl enable httpd.service
systemctl disable httpd.service
杀死服务
systemctl kill httpd
chkconfigを区別し、コントラストsystemctl
自動的に起動するサービスを作成します |
chkconfigを--level 3 httpdの上 |
httpd.serviceを有効systemctl |
サービスが自動的に起動しないように、 |
chkconfigを--level 3 httpdのオフ |
systemctl禁止httpd.service |
サービスの状態を確認してください |
サービスのhttpdのステータス |
systemctlステータスhttpd.service(サービス詳細)/ systemctlは、アクティブhttpd.service(表示のみアクティブの場合) |
カスタムサービスに参加 |
chkconfigを--addテスト |
systemctl負荷test.service |
サービスを削除します。 |
chkconfigを--del XXX |
アプリケーションを停止し、適切なコンフィギュレーションファイルを削除します |
それは、すべてのサービスが開始さを示します |
chkconfigを--list |
systemctlリスト単位--type =サービス |
サービスを開始 |
サービスのhttpd開始 |
httpd.serviceを開始systemctl |
サービスを停止します |
サービスのhttpd停止 |
systemctl停止httpd.service |
サービスを再起動します。 |
サービスのhttpdの再起動 |
systemctl再起動httpd.service |