一、创建文件
在etc/systemd/system下创建xxx.service文件
vi /etc/systemd/system/ubif.service
二、编辑文件
[Unit] Description="ubif Service" [Service] Type=simple GuessMainPID=true WorkingDirectory=/var/ubif/UbifPublish/ //项目路径 StandardOutput=journal StandardError=journal ExecStart=/usr/bin/dotnet UBIF.Web.dll //启动指令 Restart=always [Install] WantedBy=multi-user.target
三、添加到自启
cd /etc/systemd/system/ systemctl enable ubif.service
四、启动服务
systemctl start ubif.service
五、服务状态
systemctl status ubif.service //查看服务
systemctl start ubif.service //启动服务
systemctl restart ubif.service //重启服务
systemctl stop ubif.service //停止服务