在Linux CentOS7下设置netcore Net5 项目开机自启
在Linux CentOS7下设置netcore Net5 项目开机自启
一、创建文件
在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 //停止服务
© 版权声明
文章版权归作者所有,若需转载,请在显著位置标志该文章地址。