Systemd Generate
目录
创建一个systemd service配置
1. 创建一个用户 [can be ignore]
adduser {username} -s /sbin/nologin
2. 创建一个服务描述文件
vim /etc/systemd/system/{myservice}.service
文件内容:
[Unit]
Description=Service Description
After=network.target
[Service]
Type=simple
Restart=always
RestartSec=1
WorkingDirectory=/usr/local/
ExecStart=[start command]
StandardOutput=null
StandardError=null
[Install]
WantedBy=multi-user.target
3. 重载Systemd使配置生效
systemctl daemon-reload