創建並配置屬於自己的 Linux 程序服務
cd /etc/systemd/system
vim test.service內容
[Unit]
Description=TestService
[Service]
WorkingDirectory=/var/www/TestService
ExecStart=/usr/bin/dotnet /var/www/TestService/TestService.dll
SyslogIdentifier=TestService
Environment=Production
ASPNETCORE_ENVIRONMENT=Production
User=root
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target服務命令
啟動
systemctl start test.service
停止
systemctl stop test.service
重啟
systemctl restart test.service
重載配置
systemctl reload test.service
開啟自啟
systemctl enable test.service
關閉自啟
systemctl disable test.service版權屬於:zgcwkj
本文鏈接:https://www.zgcwkj.com/archives/217.html
轉載聲明:請注明本文章的標題及內容的出處和聲明,謝謝
評論已關閉