Exemplo n.º 1
0
        protected override void Unload()
        {
            UserServiceSpawner.Stop();

            dynamic json = new JObject();

            json.action = "unload";
            Bus.Emit(Bus.Channel.Status, json, true);
            Bus.Dispose();

            // Kill the sub-processes
            UserServiceSpawner.KillAll();
            ProcessHandler.KillAllEXE("FOGUserService");
            ProcessHandler.KillAllEXE("FOGTray");
        }
Exemplo n.º 2
0
 private static void KillSubProcesses()
 {
     try
     {
         UserServiceSpawner.KillAll();
         Thread.Sleep(5 * 1000);
         ProcessHandler.KillAllEXE("FOGUserService");
         ProcessHandler.KillAllEXE("FOGTray");
         Thread.Sleep(5 * 1000);
     }
     catch (Exception ex)
     {
         Log.Error(LogName, "Could not stop sub processes");
         Log.Error(LogName, ex);
     }
 }
Exemplo n.º 3
0
        private static void ApplyUpdate(IUpdate instance, string processToKill)
        {
            Log.Entry(LogName, "Shutting down service...");
            instance.StopService();

            Log.Entry(LogName, "Killing remaining processes...");
            ProcessHandler.KillAllEXE(processToKill);
            Log.Entry(LogName, "Applying update...");
            instance.ApplyUpdate();

            Log.Entry(LogName, "Starting service...");
            instance.StartService();

            if (File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "updating.info")))
            {
                File.Delete(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "updating.info"));
            }
        }
Exemplo n.º 4
0
        public bool Process(string[] args)
        {
            if (args[0].Equals("?") || args[0].Equals("help"))
            {
                Help();
                return(true);
            }

            if (args[0].Equals("run") && args.Length > 1)
            {
                var app = args[1];

                var param = "";

                if (args.Length > 2)
                {
                    param = string.Join(" ", args.Skip(2));
                }

                var code = ProcessHandler.Run(app, param, true);
                Log.Entry(LogName, "--> Return code = " + code);

                return(true);
            }

            if (args[0].Equals("runexe") && args.Length > 1)
            {
                var app = args[1];

                var param = "";

                if (args.Length > 2)
                {
                    param = string.Join(" ", args.Skip(2));
                }

                ProcessHandler.RunEXE(app, param, true);
                return(true);
            }

            if (args[0].Equals("runexe") && args.Length > 1)
            {
                var app = args[1];

                var param = "";

                if (args.Length > 2)
                {
                    param = string.Join(" ", args.Skip(2));
                }

                ProcessHandler.RunEXE(app, param, true);
                return(true);
            }

            if (args[0].Equals("runclient") && args.Length > 1)
            {
                var app = args[1];

                var param = "";

                if (args.Length > 2)
                {
                    param = string.Join(" ", args.Skip(2));
                }

                ProcessHandler.RunClientEXE(app, param, true);
                return(true);
            }

            if (args[0].Equals("kill") && args.Length > 1)
            {
                ProcessHandler.Kill(args[1]);
                return(true);
            }

            if (args[0].Equals("killexe") && args.Length > 1)
            {
                ProcessHandler.KillEXE(args[1]);
                return(true);
            }

            if (args[0].Equals("killall") && args.Length > 1)
            {
                ProcessHandler.KillAll(args[1]);
                return(true);
            }

            if (args[0].Equals("killallexe") && args.Length > 1)
            {
                ProcessHandler.KillAllEXE(args[1]);
                return(true);
            }

            return(false);
        }