注册systemd 服务

https://blog.csdn.net/qq_32711799/article/details/124695839
https://blog.csdn.net/qq_43666528/article/details/119762137

/lib/systemd/system/DotNet6Testd.service (通过rpm或者yum安装的程序默认存放路径)

/etc/systemd/system (用户自定义配置文件)

[Unit]
Description=DotNet6Testd daemon
After=network.target

[Service]
Type=forking
ExecStart=/bin/bash -c "/root/dotnet/dotnet /root/MyApp/bin/Debug/net6.0/MyApp.dll &"

[Install]
WantedBy=multi-user.target
#系统重载
systemctl daemon-reload

#开机自启动
systemctl enable DotNet6Testd

#系统启动
systemctl start DotNet6Testd
posted @ 2022-08-19 10:42  shenshu  阅读(75)  评论(0编辑  收藏  举报