예제 #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Creating database...");
            SQLite.InitDatabase();

            if (args.Length != 0)
            {
                ProcessCommands(args);
            }

            Console.WriteLine("Running in server mode.");

            using (var host = new NancyHost(new Uri("http://localhost:1235"), new CustomBootstraper()))
            {
                host.Start();
                Console.WriteLine("Running nancy on http://localhost:1235");

                Console.WriteLine("Enabling timers..");
                TimerService.InitTimers();

                Console.WriteLine("Done.");

                if (Type.GetType("Mono.Runtime") != null)
                {
                    UnixSignal.WaitAny(new UnixSignal[] {
                        new UnixSignal(Signum.SIGINT),
                        new UnixSignal(Signum.SIGTERM),
                    }, -1);
                }
                else
                {
                    Console.ReadLine();
                }
            }
        }