linux重启服务命令
重启:
或
service和systemctl
1.service命令
service命令其实是去
/etc/init.d
目录下,去执行相关程序
其中脚本需要我们自己编写
CentOS Linux 7.9.2009
CentOS Linux 7.9.2009是传统CentOS Linux 7的最后主要版本,也是很多企业历史服务器中仍可能遇到的系统版本。它以稳定、兼容RHEL 7生态、文档丰富和软件支持广泛著称,曾长期用于Web服务、数据库、虚拟化节点和企业内部业务系统。不过CentOS Linux 7已于2024年6月30日停止维护,现在继续使用会面临安全补丁缺失风险。该版本更适合旧业务迁移、历史环境恢复或离线兼容性测试。
下载
2.systemctl命令
systemd是Linux系统最新的初始化系统(init),作用是提高系统的启动速度,尽可能启动较少的进程,尽可能更多进程并发启动。systemd对应的进程管理命令是systemctl
1)systemctl命令兼容了service
即systemctl也会去/etc/init.d目录下,查看,执行相关程序
2)systemctl命令管理systemd的资源Unit
systemd的Unit放在目录/usr/lib/systemd/system(Centos)或/etc/systemd/system(Ubuntu),主要有四种类型文件.mount,.service,.target,.wants。
推荐:
【Linux视频教程】
service 服务名 restartsystemctl restart 服务名# service命令启动redis脚本
service redis start
# 直接启动redis脚本
/etc/init.d/redis start
# 开机自启动
update-rc.d redis defaultssystemctl redis startsy
stemctl redis stop
# 开机自启动systemctl enable redis