|
1234567891011121314151617181920212223242526 |
- - 来到根目录:cd /
- - 创建文件:sudo touch /etc/systemd/system/znzm.service
- - 来到目录:/etc/systemd/system
- - 修改文件的权限:sudo chmod 666 znzm.service
- ```
- [Unit]
- Description=znzm running on Ubuntu
-
- [Service]
- WorkingDirectory=/var/www/znzm
- ExecStart=/usr/bin/dotnet /var/www/znzm/DD.Local.Web.dll
- Restart=always
- # Restart service after 10 seconds if the dotnet service crashes:
- RestartSec=10
- SyslogIdentifier=dotnet-example
- User=www-data
- Environment=ASPNETCORE_ENVIRONMENT=Production
-
- [Install]
- WantedBy=multi-user.target
- ```
- - 修改文件的执行权限:sudo chmod +x znzm.service
- - 启用服务:sudo systemctl enable znzm.service
- - 启动服务:sudo systemctl start znzm.service
- - 查看服务:sudo systemclt status znzm.service
- - 重启服务器:sudo reboot
|