Exemple #1
0
func ccStart() {
	var err error
	ccNode, err = ron.NewServer(*f_ccPort, *f_iomBase)
	if err != nil {
		log.Fatalln(fmt.Errorf("creating cc node %v", err))
	}

	log.Debug("created ron node at %v %v", ccPort, *f_base)
}
Exemple #2
0
func main() {
	flag.Parse()

	logSetup()

	// register CLI handlers
	for i := range cliHandlers {
		err := minicli.Register(&cliHandlers[i])
		if err != nil {
			log.Fatal("invalid handler, `%v` -- %v", cliHandlers[i].HelpShort, err)
		}
	}

	var err error
	hostname, err = os.Hostname()
	if err != nil {
		log.Fatal("unable to get hostname: %v", hostname)
	}

	rond, err = ron.NewServer(*f_port, *f_path)
	if err != nil {
		log.Fatal("unable to create server: %v", err)
	}

	for {
		line, err := goreadline.Readline("rond$ ", true)
		if err != nil {
			return
		}
		command := string(line)
		log.Debug("got from stdin: `%s`", line)

		cmd, err := minicli.Compile(command)
		if err != nil {
			log.Error("%v", err)
			continue
		}

		// No command was returned, must have been a blank line or a comment
		// line. Either way, don't try to run a nil command.
		if cmd == nil {
			continue
		}

		for resp := range minicli.ProcessCommand(cmd) {
			minipager.DefaultPager.Page(resp.String())

			errs := resp.Error()
			if errs != "" {
				fmt.Fprintln(os.Stderr, errs)
			}
		}
	}
}
Exemple #3
0
func ccStart(portStr string) (err error) {
	if ccNode != nil {
		return fmt.Errorf("cc service already running")
	}

	ccPort = CC_PORT
	if portStr != "" {
		ccPort, err = strconv.Atoi(portStr)
		if err != nil {
			return fmt.Errorf("invalid port: %v", portStr)
		}
	}

	ccNode, err = ron.NewServer(ccPort, *f_iomBase)
	if err != nil {
		return fmt.Errorf("creating cc node %v", err)
	}

	log.Debug("created ron node at %v %v", ccPort, *f_base)
	return nil
}