Esempio n. 1
0
/*
	run a local script --  run as a go routine to run multiple in parallel
*/
func test_script(broker *ssh_broker.Broker, ch chan int, host *string, script *string, parms *string, env_file *string) {

	fmt.Fprintf(os.Stderr, "running commnand=%s parms=%s\n", *script, *parms)
	stdout, stderr, err := broker.Run_on_host(*host, *script, *parms, *env_file)
	if err != nil {
		fmt.Fprintf(os.Stderr, "command failed: %s:  %s \n", *host, err)
		fmt.Fprintf(os.Stderr, "%s", stderr.String())
	} else {
		fmt.Fprintf(os.Stderr, "command was successful:\n")
		fmt.Printf("%s\n", stdout.String())
	}

	fmt.Fprintf(os.Stderr, "go routine done:%s \n", *parms)
	ch <- 1

	return
}