Exemple #1
1
func listConfig(client *redis.Client, key string) {
	value, err := client.Hgetall(key)

	if err != nil {
		fmt.Fprintln(os.Stderr, err)
		os.Exit(1)
	}

	for key, value := range value.StringMap() {
		fmt.Println(fmt.Sprintf("%s=%s", key, value))
	}
}
Exemple #2
0
func run(client *redis.Client, key string, command string) {
	value, err := client.Hgetall(key)

	if err != nil {
		fmt.Fprintln(os.Stderr, err)
		os.Exit(111)
	}

	env := make([]string, 0)

	for key, value := range value.StringMap() {
		env = append(env, fmt.Sprintf("%s=%s", key, value))
	}

	syscall.Exec("/bin/sh", []string{"/bin/sh", "-c", command}, env)
}