在后台运行ķ红隼(Running K Kestrel in the background)

2019-10-21 17:14发布

怎样才能运行在Linux / OSX持久的方式红隼Web服务器? 我能够运行Web服务器与预期:

ķ红隼

但是,我还没有找到一种方法来背景,为持久性,即

ķ隼&

该过程开始,然后立即停止。

Answer 1:

只是尝试使用

nohup k kestrel &

在CentOS 7测试(64位)

按预期工作:)



Answer 2:

您还可以创建一个一起使用s 挞一站式守护进程 nohup的控制应用程序的init.d脚本(不仅在后台启动,也停止,自动启动在系统启动时等),这里是脚本模板,这里是说明如何安装和配置



Answer 3:

对于centos7您可以创建systemd包装:

文件/etc/systemd/system/kestrel-test.service

[Unit]
Description=Web .Net Application running on Centos

[Service]
WorkingDirectory=/www/site.tld/htdocs
ExecStart=/usr/bin/dotnet /www/site.tld/htdocs/bin/Debug/netcoreapp2.0/asp.net.dll
Restart=always
RestartSec=10
SyslogIdentifier=dotnet-example
User=aspnetcoreuser
Environment=ASPNETCORE_ENVIRONMENT=Production

[Install]
WantedBy=multi-user.target

然后,您可以通过管理它sudo service kestrel-test start (停止状态)。

此外,它适用于其他systemd OS像Ubuntu16。



文章来源: Running K Kestrel in the background