ubuntu16 中chkconfig 命令不能使用

cnblogs中最新更新地址

 

参考地址1:  ubuntu16 中chkconfig    在里面看回答;

 

在Ubuntu中,/etc/init.d已被/ usr / lib / systemd所取代。脚本仍然可以通过“服务”启动和停用。但主要命令现在是'systemctl'。chkconfig命令被留下,现在你用systemctl来做这件事。

所以,而不是:

chkconfig enable apache2

您应该查找服务名称,然后启用它

systemctl status apache2
systemctl enable apache2.service

如果你有一个systemd脚本或一个/etc/init.d脚本,并且做正确的事,Systemd已经变得更加友好。

 

参考地址2:  Ubuntu 16.04 增加bash脚本为service,开机自启服务脚本配置

 

常用命令 

重新加载service文件:      systemctl daemon-reload
启动一个服务:                 systemctl start nginx-1.13.0.service
关闭一个服务:                 systemctl stop nginx-1.13.0.service
重启一个服务:                 systemctl restart nginx-1.13.0.service
显示一个服务的状态:      systemctl status nginx-1.13.0.service
在开机时启用一个服务:   systemctl enable nginx-1.13.0.service
在开机时禁用一个服务:   systemctl disable nginx-1.13.0.service
查看服务是否开机启动:   systemctl is-enabled nginx-1.13.0.service
查看已启动的服务列表:   systemctl list-unit-files|grep enabled
查看启动失败的服务列表:systemctl --failed

apache
启动  systemctl start httpd
停止  systemctl stop httpd
重启  systemctl restart httpd


mysql
启动 systemctl start mysqld
停止 systemctl stop mysqld
重启 systemctl restart mysqld


php-fpm
启动 systemctl start php-fpm
停止 systemctl stop php-fpm
重启 systemctl restart php-fpm


nginx
启动 systemctl start nginx
停止 systemctl stop nginx
重启 systemctl restart nginx

  • 4
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
Ubuntu上,可以使用`update-rc.d`命令代替`chkconfig`命令来管理服务的启动和停止。该命令提供了一种简单的方式来设置服务在不同运行级别下的启动顺序和停止顺序。 通过运行`update-rc.d`命令,你可以激活、禁用和删除服务,以及设置服务在不同运行级别下的启动和停止顺序。例如,要将`sshd`服务设置为默认运行级别下的启动服务,可以运行`update-rc.d sshd defaults`命令。 要禁用`sshd`服务,可以运行`update-rc.d -f sshd remove`命令。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [Ubuntu上支持chkconfig命令](https://download.csdn.net/download/fwl123456lwf/86399134)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] - *2* [ubuntu无法使用chkconfig命令](https://blog.csdn.net/u012377393/article/details/54022251)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] - *3* [Ubuntuchkconfig命令](https://blog.csdn.net/chongsui7677/article/details/100805363)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值