[英]Is it possible to run a .NET Core app as Windows Service AND Linux deamon
是否可以使用相同的代码创建一个.NET Core应用程序,使其可以作为Windows服务和Linux上的守护进程运行?
你有例子/概念证明吗?
Linux守护程序服务可以使用可以在系统上执行的任何语言。
守护进程可以使用systemd执行(在Fedora中:systemctl start name.service)。 要将程序放在Linux Systemd服务上,您应该创建一个新的.service文件并将其移至“ / etc / systemd / system /”
服务的语法为:
[Unit]
Description=The description of your service
After=previous services needed
[Service]
ExecStart=The program execution /sbin/helloworld.exe
ExecStop=The command given when killing the service
[Install]
WantedBy=services that needs your service
有关Linux-Red Hat服务和服务模块的更多信息: https : //access.redhat.com/documentation/zh-CN/Red_Hat_Enterprise_Linux/7/html/System_Administrators_Guide/sect-Managing_Services_with_systemd-Unit_Files.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.