diff --git a/merlin/sync/process.go b/merlin/sync/process.go index c4b3514..86678d1 100644 --- a/merlin/sync/process.go +++ b/merlin/sync/process.go @@ -99,12 +99,6 @@ func startRepoSync(repo *config.Repo) { repo.Logger.Debug("Changes found; will attempt to sync") } - args := getSyncCommand(repo) - if len(args) == 0 { - repo.Logger.Error("zero length command given for sync") - return - } - // clear the rsync log file before starting the sync if repo.RsyncLogFile != "" { err := os.Truncate(repo.RsyncLogFile, 0) @@ -113,6 +107,12 @@ func startRepoSync(repo *config.Repo) { } } + args := getSyncCommand(repo) + if len(args) == 0 { + repo.Logger.Error("zero length command given for sync") + return + } + ch := spawnProcess(repo, args) if ch == nil { // spawnSyncProcess will have already logged error diff --git a/merlin/sync/sync.go b/merlin/sync/sync.go index fae9013..df36195 100644 --- a/merlin/sync/sync.go +++ b/merlin/sync/sync.go @@ -198,10 +198,20 @@ func cscSyncDebian(repo *config.Repo) []string { args = append(args, addConditionalFlags(repo, baseFlags|excludeTmp|ipv4)...) args = append(args, buildRsyncDaemonHost(repo)+"/pool/", buildDownloadDir(repo)+"/pool/") - args = append(args, []string{ - "&&", "nice", "rsync", "-rlHtvp", + ch := spawnProcess(repo, args) + if ch == nil { + // spawnSyncProcess will have already logged error + return nil + } + cmd := <-ch + if cmd.ProcessState.ExitCode() != 0 { + return nil + } + + args = []string{ + "nice", "rsync", "-rlHtvp", "--exclude", filepath.Join("project/trace", config.Conf.Hostname), - }...) + } args = append(args, addConditionalFlags(repo, baseFlags|excludeTmp|ipv4|delayUpdatesDeleteAfter)...) args = append(args, buildRsyncDaemonHost(repo), buildDownloadDir(repo))