大飞_dafei

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

ubuntu16 中chkconfig 命令不能使用

参考地址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

 

posted on   大飞_dafei  阅读(577)  评论(0编辑  收藏  举报

编辑推荐:
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
阅读排行:
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· Docker 太简单,K8s 太复杂?w7panel 让容器管理更轻松!
点击右上角即可分享
微信分享提示