|
|
|
@ -53,11 +53,11 @@ func SendStatus(conn net.Conn) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
status := tabwriter.NewWriter(conn, 5, 5, 5, ' ', 0) |
|
|
|
|
fmt.Fprintf(status, "Repository\tLast Synced\tNext Expected Sync\tRunning\n") |
|
|
|
|
fmt.Fprintf(status, "Repository\tLast Synced\tNext Expected Sync\tLast Exit\tRunning\n") |
|
|
|
|
|
|
|
|
|
// get the names of all of the repos in the config
|
|
|
|
|
var keys []string |
|
|
|
|
for name, _ := range config.RepoMap { |
|
|
|
|
for name := range config.RepoMap { |
|
|
|
|
keys = append(keys, name) |
|
|
|
|
} |
|
|
|
|
sort.Strings(keys) |
|
|
|
@ -68,11 +68,18 @@ func SendStatus(conn net.Conn) { |
|
|
|
|
repo := config.RepoMap[name] |
|
|
|
|
lastSync := repo.State.LastAttemptStartTime |
|
|
|
|
nextSync := lastSync + int64(repo.Frequency) |
|
|
|
|
lastExit := "failed" |
|
|
|
|
if repo.State.LastAttemptExit == config.SUCCESS { |
|
|
|
|
lastExit = "completed" |
|
|
|
|
} else if repo.State.LastAttemptExit == config.TERMINATED { |
|
|
|
|
lastExit = "terminated" |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fmt.Fprintf(status, "%s\t%s\t%s\t%t\n", |
|
|
|
|
fmt.Fprintf(status, "%s\t%s\t%s\t%s\t%t\n", |
|
|
|
|
name, |
|
|
|
|
time.Unix(lastSync, 0).In(location).Format(time.RFC1123), |
|
|
|
|
time.Unix(nextSync, 0).In(location).Format(time.RFC1123), |
|
|
|
|
lastExit, |
|
|
|
|
repo.State.IsRunning, |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|