Use API daemon() for BSD Unix computers to create background jobs.
using System;
using System.Runtime.InteropServices;
class DaemonApplication
{
[DllImport ("__Internal", EntryPoint="daemon")]
static extern int daemon (int nochdir, int noclose);
public static void Main(string[] args)
{
System.Console.WriteLine("Starting daemon..." );
daemon(0, 0);
while(true)
{
System.Threading.Thread.Sleep(100);
}
}
}