Closed ayappant closed 6 years ago
@ayappant, hi there, I believe you don't need this library if your application only runs on Linux. Here's a simple guide how to do so (Go to the link)
That means you have to do checks for each platform yourself, at a runtime.
using runtime checks / switches
And if you really want to target both platforms, then you would write something like this, i guess:
if (System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
// your code to handle the control to this library
}
// since Linux doesn't need any daemon-specific code just do your normal code
@ayappant exactly like @Trapov said, a cross-platform "service" would only use this specific library for windows-specific parts.
Running as a linux daemon that starts and stops should already be possible with classic console applications, though more sophisticated control logic is probably blocked on proper signal handling. Also see https://github.com/dotnet/corefx/issues/25384
Closing as out of scope.
How should I get this working as daemon on linux? Any samples would help
"Build truly portable applications that can for example run as service on windows and as daemon on linux, just using runtime checks / switches"