1. 关于服务:
参考文章:https://www.jianshu.com/p/79059b06a121
2. 编辑服务配置
sudo vim /usr/lib/systemd/system/*.service
[Unit]
Description=This is a test service
[Service]
Type=simple # simple: 默认值,主进程 forking: 后台运行,子进程
ExecStart=
ExecReload=
ExecStop=
[Install]
WantedBy=multi-user.target
3. 服务控制
重载系统服务:systemctl daemon-reload
设置开机启动:systemctl enable *.service
启动服务:systemctl start *.service
停止服务:systemctl stop *.service
重启服务:systemctl restart *.service
本文档介绍了如何编辑和管理Systemd服务。首先,展示了服务配置文件的详细内容,包括[Unit]、[Service]和[Install]部分的设置。接着,阐述了使用systemctl进行服务的重载、启用、启动、停止和重启等操作。这是一篇针对系统管理员的实用指南。
989

被折叠的 条评论
为什么被折叠?



