You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 satır
592B

  1. package main
  2. import (
  3. "fmt"
  4. log "github.com/sirupsen/logrus"
  5. "os/exec"
  6. "time"
  7. )
  8. func pullStaticHtml(local string, remote string, key string) {
  9. ssh := fmt.Sprintf("/usr/bin/ssh -i %s ", key)
  10. // rsync -Pav -e "ssh -i $HOME/.ssh/someKey" username@hostname:/from/dir/ /to/dir/
  11. for {
  12. cmd := exec.Command("rsync", "-Pavz", "--rsh", ssh, remote, local)
  13. // cmd := exec.Command("sh", "-c", "echo stdout; echo 1>&2 stderr")
  14. stdoutStderr, err := cmd.CombinedOutput()
  15. if err != nil {
  16. log.Error(err)
  17. break
  18. }
  19. log.Printf("%s\n", stdoutStderr)
  20. time.Sleep(5 * time.Second)
  21. }
  22. }