示例#1
0
        public int startProcess(Process p)
        {
            if (!p.isDefined())
            {
                this.defineProcess(p);
                if (!p.isDefined())
                {
                    return(-4);                    //process misconfigured
                }
            }
            string start = "start process \n";

            start = start + "id:" + p.getId() + "\n\n";
            if (!sendMessage(start))
            {
                return(-2);
            }
            SimpleCPCParser.parse(p, m_socket);
            if (p.getStatus().Equals(Process.Status.Running))
            {
                return(1);
            }
            else
            {
                return(-1);
            }
        }
示例#2
0
        public int listProcesses()
        {
            string list = "list processes\n\n";

            if (!sendMessage(list))
            {
                return(-2);
            }

            SimpleCPCParser.parse(m_processes, this, m_socket);
            return(1);
        }
示例#3
0
        public int undefineProcess(Process p)
        {
            if (!p.isDefined())
            {
                return(-4);                //process not defined
            }
            string undefine = "undefine process \n";

            undefine = undefine + "id:" + p.getId() + "\n\n";
            if (!sendMessage(undefine))
            {
                return(-2);
            }
            SimpleCPCParser.parse(p, m_socket);
            if (!p.isDefined())
            {
                return(1);
            }
            return(-1);
        }
示例#4
0
        public int defineProcess(Process p)
        {
            string define = "define process \n";

            define = define + "name:" + p.getName() + "\n";
            define = define + "group:" + p.getDatabase() + "\n";
            define = define + "env:" + "NDB_CONNECTSTRING=" + p.getConnectString();
            if (p.getEnv().Equals(""))
            {
                define = define + "\n";
            }
            else
            {
                define = define + " " + p.getEnv() + "\n";
            }

            //if(p.getPath().EndsWith("\\"))
            //	define = define + "path:" + p.getPath()+ "ndb" + "\n";
            //else
            define = define + "path:" + p.getPath() + "\n";
            define = define + "args:" + p.getArgs() + "\n";
            define = define + "type:" + "permanent" + "\n";
            define = define + "cwd:" + p.getCwd() + "\n";
            define = define + "owner:" + "ejohson" + "\n\n";

            if (!sendMessage(define))
            {
                return(-2);
            }

            SimpleCPCParser.parse(p, m_socket);
            if (p.isDefined())
            {
                return(1);
            }
            else
            {
                return(-1);
            }
        }
示例#5
0
        public int stopProcess(Process p)
        {
            if (!p.isDefined())
            {
                return(-4);                //process not defined
            }
            string stop = "stop process \n";

            stop = stop + "id:" + p.getId() + "\n\n";
            if (!sendMessage(stop))
            {
                return(-2);
            }
            SimpleCPCParser.parse(p, m_socket);

            if (p.getStatus().Equals(Process.Status.Stopped))
            {
                return(1);
            }
            else
            {
                return(-1);
            }
        }