1切威、添加服務(wù)文件
- vim /etc/systemd/system/skynet.service
[Unit]
Description=Skynet Transfer Gateway
After=network.target
[Service]
# 配置執(zhí)行文件完成路徑
ExecStart=/opt/skynet_transfer_prod/r_skynet_service
Restart=always
User=root
Group=root
# 配置文件變量
Environment=RUST_LOG=info,cargo=info,actix_web=info
# 工作目錄
WorkingDirectory=/opt/skynet_transfer_prod
[Install]
WantedBy=multi-user.target
2错洁、啟動服務(wù)
# 修改配置后,需要刷新
systemctl daemon-reload
# 開機啟動
systemctl enable skynet
systemctl start skynet
# 查看所有 service 列表
systemctl