Linux 服务开机自动启动
以httpd为例,默认安装完成后,需通过systemctl start启动。
重启后,不会自动启动,每次需要systemctl start启动,过于麻烦。
通过chkconfig命令设置开机自动启动。
语法
开机自动启动
chkconfig 服务名 on
 
关闭开机自动启动
chkconfig 服务名 off
 
示例
Apache设为自动启动
chkconfig httpd on
 
重启后,查看服务httpd状态为Active。OK。
以httpd为例,默认安装完成后,需通过systemctl start启动。
重启后,不会自动启动,每次需要systemctl start启动,过于麻烦。
通过chkconfig命令设置开机自动启动。
语法
开机自动启动
chkconfig 服务名 on
 
关闭开机自动启动
chkconfig 服务名 off
 
示例
Apache设为自动启动
chkconfig httpd on
 
重启后,查看服务httpd状态为Active。OK。