Ejemplo n.º 1
0
 public Activity(Pmta pmta, string vmta, int activityType)
 {
     Pmta = pmta;
     Vmta = vmta;
     ActivityTypeId = activityType;
     DateUpdated = DateTime.Now;
     DateCreated = DateTime.Now;
 }
Ejemplo n.º 2
0
        public void Purge(Pmta pmta, string vmta)
        {
            _log.InfoFormat("Purge VMTA:{0}, PMTA:{1}", vmta, pmta.Host);

            var cmd = string.Format("/usr/sbin/pmta delete --queue={0}", vmta);

            RunCommand(cmd, pmta);
        }
Ejemplo n.º 3
0
        public void RemoveBackoff(Pmta pmta, string vmta)
        {
            _log.InfoFormat("Remove backoff VMTA:{0}, PMTA:{1}", vmta, pmta.Host);

            var cmd = string.Format("/usr/sbin/pmta set queue --mode=normal {0}", vmta);

            RunCommand(cmd, pmta);
        }
Ejemplo n.º 4
0
        public void UnPause(Pmta pmta, string vmta)
        {
            _log.InfoFormat("Un-Pause VMTA:{0}, PMTA:{1}", vmta, pmta.Host);
            _emaiLog.InfoFormat("Un-Pause VMTA:{0}, PMTA:{1}", vmta, pmta.Host);

            var cmd = string.Format("/usr/sbin/pmta resume queue {0}", vmta);

            RunCommand(cmd, pmta);
        }
Ejemplo n.º 5
0
        public void DeleteJob(Pmta pmta, int jobID)
        {
            _log.InfoFormat("Delete Job: {0}", jobID);
            _emaiLog.InfoFormat("Delete Job: {0}", jobID);

            var cmd = string.Format("/usr/sbin/pmta delete --job={0}", jobID);

            RunCommand(cmd, pmta);
        }
Ejemplo n.º 6
0
        //Host comes from the DG...
        public IList<string> GetHotmailVmtasForHost(Pmta pmta, string host)
        {
            _log.InfoFormat("Get all Hotmail from PMTA: {0} for host={1}", pmta.Host, host);

            var results = RunCommand(String.Format("/usr/sbin/pmta show queues --mode=normal | mode=backoff | grep hotmail | grep {0} | cut -d\" \" -f1", host), pmta);

            if (string.IsNullOrWhiteSpace(results))
                return new List<string>();

            return results.Split('\n').ToList().Where(x => !string.IsNullOrWhiteSpace(x)).ToList();
        }
Ejemplo n.º 7
0
        public IList<string> GetVmtasInBackoffMode(Pmta pmta)
        {
            _log.InfoFormat("Get all backoff from PMTA: {0}", pmta.Host);

            var results = RunCommand("/usr/sbin/pmta show queues --mode=backoff | grep hotmail | grep 421 | cut -d\" \" -f1", pmta);

            if (string.IsNullOrWhiteSpace(results))
                return new List<string>();

            return results.Split('\n').ToList().Where(x => !string.IsNullOrWhiteSpace(x)).ToList();
        }
Ejemplo n.º 8
0
        private string RunCommand(string cmd, Pmta pmta)
        {
            try
            {
                using (var client = new SshClient(pmta.Host, pmta.Username, pmta.Password))
                {
                    client.Connect();
                    _log.InfoFormat("Run Command:{0}, PMTA:{1}", cmd, pmta.Host);
                    var command = client.RunCommand(cmd);
                    client.Disconnect();

                    if (command.ExitStatus != 0 && !string.IsNullOrWhiteSpace(command.Error))
                        throw new Exception(string.Format("PMTA Command error: {0}", command.Error));

                    return command.Result;
                }
            }
            catch (Exception e)
            {
                throw new Exception("PMTA Command error", e);
            }
        }