I assume “file backup” means the PS script. The above sounds like they’re independent, except Duplicati is a convenient scheduler, but earlier statement below sounded like there was also a desire for time proximity:
but this worries me:
because if it hangs or errors, then Duplicati may see its issue. run-script-timeout sounds like it can handle a hung script (although I’m not sure how Windows will feel if a hang happens every run – infinite buildup?). Duplicati is also sensitive to exit codes from the script, so you want to make sure you don’t “signal” wrong:
Also be careful of messages from the script when it’s unreliable. Script output is interpreted per the below:
Where does script output go to (difference between BEFORE and AFTER?)
The second quirky thing is standard Windows quirkiness, as described earlier. You can’t even run PS from Command Prompt via the ps1
suffix. It opens in notepad. Interestingly, perl system also does. Explanation:
Command line of the running process:
cmd.exe /x/d/c C:\ProgramData\Duplicati\duplicati-2.0.5.110_canary_2020-08-10\utility-scripts\DuplicatiVerify.ps1
Option parsing is not always the easiest thing, but one way to take care of it is as above – let a command line interpreter do its thing. A thing it does not apparently do (much as one might want it) is run interpreter based on the file extension. It can sometimes, but I’m not sure of method. My Strawberry Perl installation allows me to run .pl
scripts, and frankly I’m surprised Microsoft didn’t provide any ability to run .ps1
files.
Given the situation, it seems to me an entirely reasonable thing to use a batch file, and why even justify it?
While you might need to squash or catch the PS exit code, basically it’s powershell <path to script>
.