DS7/DSWeb.Job.Common/Program.cs

44 lines
1.3 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using Quartz.Impl;
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Threading.Tasks;
namespace DSWeb.Job.Common.Common
{
class Program
{
static void Main(string[] args)
{
if (Environment.UserInteractive)
{
Console.Title = "大简云-通用服务程序";
Console.WriteLine("服务启动中……");
StdSchedulerFactory.GetDefaultScheduler().Start();
StdSchedulerFactory.GetDefaultScheduler().ListenerManager.AddSchedulerListener(new JobListener());
Console.WriteLine("服务已启动输入quit退出");
while (true)
{
if (Console.ReadLine() == "quit")
{
StdSchedulerFactory.GetDefaultScheduler().Shutdown();
break;
}
}
}
else
{
ServiceBase[] ServicesToRun;
ServicesToRun = new ServiceBase[]
{
new MyshippingCommonService()
};
ServiceBase.Run(ServicesToRun);
}
}
}
}