linux重启服务命令
重启:
service 服务名 restart
或
systemctl restart 服务名
service和systemctl
1.service命令
service命令其实是去/etc/init.d目录下,去执行相关程序
# service命令启动redis脚本 service redis start # 直接启动redis脚本 /etc/init.d/redis start # 开机自启动 update-rc.d redis defaults
其中脚本需要我们自己编写
2.systemctl命令
systemd是linux系统最新的初始化系统(init),作用是提高系统的启动速度,尽可能启动较少的进程,尽可能更多进程并发启动。systemd对应的进程管理命令是systemctl
1)systemctl命令兼容了service
即systemctl也会去/etc/init.d目录下,查看,执行相关程序
systemctl redis startsy stemctl redis stop # 开机自启动systemctl enable redis
2)systemctl命令管理systemd的资源Unit
systemd的Unit放在目录/usr/lib/systemd/system(centos)或/etc/systemd/system(ubuntu),主要有四种类型文件.mount,.service,.target,.wants。
推荐:【Linux视频教程】
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
喜欢就支持一下吧
相关推荐