diff --git a/views/routine_list.nim b/views/routine_list.nim
index 053fe5f..ccddf7f 100644
--- a/views/routine_list.nim
+++ b/views/routine_list.nim
@@ -36,6 +36,8 @@ proc rsyncThread(list: RoutineListState) {.thread.} =
#i'm not sure if using threadvar here is needed, but doing it just in case. :)
var rsyncRunCmd {.threadvar.}: string
var rsyncRun {.threadvar.}: tuple[output: string, exitCode: int]
+ var rsyncCheckCmd {.threadvar.}: string
+ var rsyncCheckRun {.threadvar.}: tuple[output: string, exitCode: int]
var rsyncErrors: seq[string]
var routineRunCount: int
@@ -48,9 +50,6 @@ proc rsyncThread(list: RoutineListState) {.thread.} =
routineRuncount += 1
for source in routine.sources:
for destination in routine.destinations:
- #per source/dest combo msgs still don't seem to be working right.
- #maybe it requires a separate thread per combo? deprioritized.
- #list.runStatus = "Bkup " & source & " to " & destination & "..."
#try without requiring superuser privs by default.
rsyncRunCmd = "rsync -aq " & source & " " & destination
rsyncRun = execCmdEx(rsyncRunCmd)
@@ -66,16 +65,37 @@ proc rsyncThread(list: RoutineListState) {.thread.} =
rsyncRun = execCmdEx(rsyncRunCmd)
if rsyncRun.exitCode != 0:
rsyncErrors.add("EZ-Bkup's rsync process(es) returned error (" & $rsyncRun.output & ") while attempting to back up " & source & " to " & destination)
+ #handle non-perms related error.
else:
rsyncErrors.add("EZ-Bkup's rsync process(es) returned error (" & $rsyncRun.output & ") while attempting to back up " & source & " to " & destination)
+ #explicitly check that sources were copied to destinations.
+ #just using file names, mod times, and size (same as bkup run itself).
+ rsyncCheckCmd = "rsync -rn " & source & " " & destination
+ rsyncCheckRun = execCmdEx(rsyncCheckCmd)
+ if rsyncCheckRun.exitCode != 0:
+ #handle permission denied error.
+ if rsyncCheckRun.exitCode == 23:
+ rsyncCheckRun.exitCode = 0
+ if getAskPassPath() == "":
+ let err = "No ssh-askpass binary found. Please install an ssh-askpass package for your distro, and let us know if EZ-Bkup still can't detect it's location."
+ rsyncErrors.add(err)
+ else:
+ rsyncCheckCmd = "SUDO_ASKPASS=" & getAskPassPath() & " sudo -A rsync -rn " & source & " " & destination
+ rsyncCheckRun = execCmdEx(rsyncCheckCmd)
+ if rsyncCheckRun.exitCode != 0:
+ rsyncErrors.add("EZ-Bkup's rsync process(es) returned error (" & $rsyncRun.output & ") while attempting to verify that " & source & " got backed up to " & destination)
+ #handle non-perms related error.
+ else:
+ rsyncErrors.add("EZ-Bkup's rsync process(es) returned error (" & $rsyncRun.output & ") while attempting to verify that " & source & " got backed up to " & destination)
+
if rsyncErrors.len > 0:
- list.runStatus = "Error! Please see the log at ~/.ez-bkup/errors.log"
+ list.runStatus = "Error! Please see ~/.ez-bkup/errors.log"
for err in rsyncErrors:
logger.log(lvlError, err)
elif routineRunCount == 0:
list.runStatus = "Meh. No Bkup Routines were run."
else:
- list.runStatus = "Bkup Complete!"
+ list.runStatus = "Bkup Complete!"
list.redrawFromThread()
@@ -214,8 +234,8 @@ method view(list: RoutineListState): Widget =
xAlign = 0
useMarkup = true
proc clicked() =
- #check that every source and destination exists for each routine or don't run bkup and show dialog.
- #locations not found will be logged. see shared.nim
+ #check that every source and destination exists for each routine or don't run bkup and show err status.
+ #locations not found will be logged. see routine.nim
var allLocationsExist: seq[bool]
for routine in list.routineModel.routineSeq():
if routine.id in list.selected: