static void Main(string[] args) { // parse the command line try { if (Environment.UserName.Equals("System", StringComparison.OrdinalIgnoreCase)) { ServiceBase[] ServicesToRun; ServicesToRun = new ServiceBase[] { new LogrotateService() }; ServiceBase.Run(ServicesToRun); } else { Rotater rotater = new Rotater(args); rotater.Process(); } } catch (Exception e) { Logging.LogException(e); Environment.Exit(1); } }