1,新建service文件vim
vim /etc/systemd/system/dotnetTest.serviceip
内容
[Unit]
Description=dotnet consoleit
[Service]io
WorkingDirectory=/home/useeinfo/publishconsole
ExecStart=/usr/bin/dotnet /home/useeinfo/publish/ConsoleApp3.dlltest
Restart=alwaysservice
SyslogIdentifier=dotnet core consoleim
User=roottop
Environment=ASPNETCORE_ENVIRONMENT=Productiondi
2,开启服务
systemctl start dotnetTest.service
查看状态
systemctl status dotnetTest.service
Loaded: loaded (/etc/systemd/system/dotnetTest.service; disabled; vendor pres
Active: active (running) since Mon 2019-03-04 14:10:55 CST; 20s ago
Main PID: 6893 (dotnet)
Tasks: 10 (limit: 4915)
Memory: 27.1M
CGroup: /system.slice/dotnetTest.service
└─6893 /usr/bin/dotnet /home/wht/DotNetCore/test/ConsoleApp1.dll
中止服务
systemctl stop dotnetTest.service