incompleted cm

This commit is contained in:
snoop 2017-04-15 20:27:40 +09:00
parent 5c617fe5fa
commit 6fb4e8e935
3 changed files with 20 additions and 15 deletions

View File

@ -16,6 +16,7 @@ import (
const (
address = "localhost:"
portArgsName = "-Port="
defaultPort = 50000
rootFolder = "/home/cm/"
@ -182,7 +183,7 @@ func (c *CrawlerManager)runContainer(container *string) error {
cmdStr := getRunCommand(container)
for {
pArg := "-Port=" + strconv.Itoa(c.currentPort)
pArg := portArgsName + strconv.Itoa(c.currentPort)
cmd := exec.Command(cmdStr, pArg)
err := cmd.Start()
@ -264,18 +265,6 @@ func (c *CrawlerManager)removeProcessFile(pid *string) {
}
}
func writePid(pid int) {
ioutil.WriteFile(PidFolder + strconv.Itoa(pid), []byte(""), os.ModePerm)
}
func getConfigPaths(container *string) *[]string {
var dirs []string
existConfigFileDir(ConfigFolder, *container, &dirs)
return &dirs
}

View File

@ -245,6 +245,6 @@ func TestRunRun(t *testing.T) {
GetInstance().runContainer(&c)
//GetInstance().stopContainer(&c)
GetInstance().stopContainer(&c)
}

View File

@ -1,6 +1,10 @@
package crawler_manager
import "io/ioutil"
import (
"io/ioutil"
"strconv"
"os"
)
func existConfigFile(prePath string,dir string) bool {
@ -41,3 +45,15 @@ func getRunCommand(container *string ) string {
return BinaryFolder + "/" + *container + "/" + runFile
}
func writePid(pid int) {
ioutil.WriteFile(PidFolder + strconv.Itoa(pid), []byte(""), os.ModePerm)
}
func getConfigPaths(container *string) *[]string {
var dirs []string
existConfigFileDir(ConfigFolder, *container, &dirs)
return &dirs
}