modify arthur status message

pull/3/head
Andrew Wang 5 months ago
parent 2492d533f0
commit 594dc2e0d4
  1. 2
      merlin/README.md
  2. 13
      merlin/arthur/arthur.go
  3. 3
      merlin/cmd/arthur/arthur.go
  4. 1
      merlin/merlin-config.ini

@ -14,6 +14,8 @@ Then configure `merlin-config.ini` and run using `./merlin`
### Nice Features To Add
- detect if an rsync process is stuck (watch the stdout/stderr of the rsync processes)
- get the config or the rsync commond that a repo will sync with using a cli tool
- improve conversion from exit status enum to string
- sort `arthur status` by last time synced
### Completed
- [x] add bwlimit option for each rsync process

@ -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,
)
}

@ -9,7 +9,8 @@ import (
"os"
)
var DEFAULT_SOCKET_PATH = "/home/mirror/merlin/merlin.sock"
// var DEFAULT_SOCKET_PATH = "/home/mirror/merlin/merlin.sock"
var DEFAULT_SOCKET_PATH = "/mirror/merlin/run/merlin-go.sock"
var HELP_MESSAGE = `USAGE:
arthur [-h|--help] [--sock <socket_path>] COMMAND

@ -15,7 +15,6 @@ sock_path = /mirror/merlin/run/merlin-go.sock
[puppylinux]
verbose = true
dry_run = true
sync_type = csc-sync-standard
frequency = twice-daily
local_dir = puppylinux

Loading…
Cancel
Save