1、
cd /etc/systemd/system
2、
vim rtgapi.service
[Unit] Description=rtgapi [Service] WorkingDirectory=/home/rtgweb/api/ ExecStart=/usr/bin/dotnet /home/rtgweb/api/rtgapi.dll Restart=always # Restart service after 10 seconds if the dotnet service crashes: RestartSec=10 KillSignal=SIGINT SyslogIdentifier=douyin and kuaishou User=root Environment=ASPNETCORE_ENVIRONMENT=Production Environment=ASPNETCORE_URLS=http://0.0.0.0:8081 [Install] WantedBy=multi-user.target
3、systemctl 服务管理
服务开启: systemctl start rtgapi.service 状态: systemctl status rtgapi.service systemctl restart rtgapi.service systemctl stop rtgapi.service 查看日志 journalctl -fu rtgapi.service
标签:service,api,新建,0.0,rtgapi,Environment,systemctl,ubuntu From: https://www.cnblogs.com/shuihuren/p/17650586.html