centos 8 下設(shè)置.net core項(xiàng)目開機(jī)自動(dòng)啟動(dòng)
1.1在/etc/systemd/system 下創(chuàng)建pgsqlcodefirst.service文件;
pgsqlcodefirst.service文件添加:
[Unit]
Description="pgsqlcodefirst.Service"
[Service]
Type=simple
GuessMainPID=true
WorkingDirectory=/home/net50/
StandardOutput=journal
StandardError=journal
ExecStart=/usr/lib64/dotnet/dotnet /home/net50/pgsqlcodefirst.dll //啟動(dòng)指令
Restart=always
[Install]
WantedBy=multi-user.target
2.使自啟動(dòng)生效
systemctl enable pgsqlcodefirst.service
3.立即啟動(dòng)項(xiàng)目服務(wù)
systemctl start pgsqlcodefirst.service
systemctl stop pgsqlcodefirst.service
systemctl restart pgsqlcodefirst.service
systemctl list-units --type=service
5.重啟服務(wù):
shutdown -r now
6.重啟后訪問:http://ip:port/