Пример #1
0
        public void Init(SSHParam inparam, STRule inrule, string innodename)
        {
            sshParam = inparam;
            string filepathname = string.Format("/tmp/{0}{1}{2}", innodename, DateTime.Now.ToString("yyyy-MM-dd-hh-mm-ss"), inrule.rFileName);

            inrule.rFileName = filepathname;
            STTask task = new STTask();

            task.myRule = inrule;
            task.hName  = innodename;
            task.GetCmdLine();
            myTask = task;
            try {
                sshclient = new SshClient(sshParam.hostIP, sshParam.userName, sshParam.userPWD);
                if (sshclient == null)
                {
                    return;
                }
                sshclient.Connect();
                sshcmd     = sshclient.CreateCommand(task.GetCmdLine());
                ssharesult = sshcmd.BeginExecute();
            } catch (Exception exc) {
                exc.ToString();
            }
        }
Пример #2
0
 public string ExecuteTask(STTask intask)
 {
     if (intask.myRule.rType == STRuleType.Block)
     {
         string cmd = intask.GetCmdLine();
         tb.Text += cmd + Environment.NewLine + ExecuteBlockCmd(cmd).Replace("\n", Environment.NewLine) + Environment.NewLine;
     }
     return(string.Empty);
 }
Пример #3
0
        public void get_simple_log()
        {
            tb_output.Clear();
            main.ClearTask();
            RulesUpdate();
            STTask        task;
            List <string> allnodes = GetSelectedNodes();

            foreach (string lnodename in allnodes)
            {
                task        = new STTask();
                task.myRule = journal_short_rule;
                if (lnodename.CompareTo(NODENAME_DEFAULT) != 0)
                {
                    task.hName = lnodename;
                }
                main.AddTask(task);
            }

            main.RunJob();
        }
Пример #4
0
 public void AddTask(STTask intask)
 {
     myJob.AddTask(intask);
 }
Пример #5
0
 public void AddTask(STTask inTask)
 {
     allTasks.Add(inTask);
 }