Changeset 11365 for trunk/sources/HeuristicLab.Services.Hive.JanitorService
- Timestamp:
- 09/15/14 10:45:57 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Services.Hive.JanitorService/3.3/Program.cs
r11171 r11365 20 20 #endregion 21 21 22 using System; 23 using System.Configuration.Install; 24 using System.Reflection; 22 25 using System.ServiceProcess; 23 26 24 27 namespace HeuristicLab.Services.Hive.JanitorService { 25 28 static class Program { 26 /// <summary> 27 /// The main entry point for the application. 28 /// </summary> 29 static void Main() { 30 ServiceBase[] ServicesToRun; 31 ServicesToRun = new ServiceBase[] 32 { 33 new JanitorService() 34 }; 35 ServiceBase.Run(ServicesToRun); 29 private static void Main(string[] args) { 30 // Install as service, see http://stackoverflow.com/a/12703878 31 if (Environment.UserInteractive) { 32 try { 33 string parameter = string.Concat(args); 34 switch (parameter) { 35 case "--install": 36 ManagedInstallerClass.InstallHelper(new[] { Assembly.GetExecutingAssembly().Location }); 37 break; 38 case "--uninstall": 39 ManagedInstallerClass.InstallHelper(new[] { "/u", Assembly.GetExecutingAssembly().Location }); 40 break; 41 } 42 } 43 catch (Exception ex) { 44 Console.WriteLine("Error on (un)install of Hive Slave service: " + Environment.NewLine + ex); 45 } 46 } else { 47 ServiceBase[] ServicesToRun; 48 ServicesToRun = new ServiceBase[] 49 { 50 new JanitorService() 51 }; 52 ServiceBase.Run(ServicesToRun); 53 } 36 54 } 37 55 }
Note: See TracChangeset
for help on using the changeset viewer.