I want to prevent a backup profile from running if Windows signals that a drive failure is imminent (SMART) on the source drive. This would be a measure to both limit drive activity and not copy potentially corrupt files in the event of a decaying drive state.
I have an Windows console app (DriveHealth.exe) that I can call in which the exit code is 0 if all is well, or non-zero (1) if the specified drive is flagged as going bad. It also outputs to the console, but that is a verbose text output that I would have to parse for a boolean go / no-go value.
I figured I could use a pascal script in Syncovery to call this app and catch it's exit code, but I'm not sure if that is possible.
I wrote the little DriveHealth app, so I guess I could add a switch to make the console output a simple TRUE/FALSE if all I can read in Syncovery is the console output.
Any ideas on how I could best implement this?
On a side note, it would be nice if the Execute Command Before feature could have a way to abort the profile run if the command or script returned an error code.
Use return code on external command to inhibit a profile?
Re: Use return code on external command to inhibit a profile?
Hello,
yes, if you call DriveHealth.exe directly from the execute before/after command line, then a non-zero exit code will stop the profile.
But if you call a batch file or similar, the exit code from DriveHealth.exe is probably lost and not passed on to Syncovery.
yes, if you call DriveHealth.exe directly from the execute before/after command line, then a non-zero exit code will stop the profile.
But if you call a batch file or similar, the exit code from DriveHealth.exe is probably lost and not passed on to Syncovery.
Re: Use return code on external command to inhibit a profile?
Excellent. I should have tested the run-before functionality with a non-zero exit code before posting.
Should I need to have a script interrupt a job rather than this utility, I can simply code the script to return a non-zero exit code depending on the conditions it's checking.
Thanks for your help.
Should I need to have a script interrupt a job rather than this utility, I can simply code the script to return a non-zero exit code depending on the conditions it's checking.
Thanks for your help.