whip it good
Jes Olson j3s@c3f.net
Fri, 30 Sep 2022 18:19:37 -0500
2 files changed,
27 insertions(+),
1 deletions(-)
M
main.go
→
main.go
@@ -62,7 +62,19 @@ }
} } - err = shell.SSH("sudo zoa https://git.sr.ht/~j3s/testy", hosts) + err = shell.SCP("main", hosts) + if err != nil { + log.Fatal(err) + } + err = shell.SCPDir("scripts", hosts) + if err != nil { + log.Fatal(err) + } + err = shell.SCPDir("files", hosts) + if err != nil { + log.Fatal(err) + } + err = shell.SSH("sudo zoa .", hosts) if err != nil { log.Fatal(err) }
M
shell/shell.go
→
shell/shell.go
@@ -187,3 +187,17 @@ return err
} return nil } + +func SCPDir(dir string, hostlist []string) error { + _, err := exec.LookPath("scp") + if err != nil { + log.Fatal(err) + } + for _, server := range hostlist { + cmd := exec.Command("scp", "-r", dir, server+":"+dir) + cmd.Stdout = os.Stdout + err := cmd.Run() + return err + } + return nil +}