创建并配置属于自己的 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://zgcwkj.com/archives/217.html
转载声明:请注明本文章的标题及内容的出处和声明,谢谢
评论已关闭