Replies: 1 comment
-
|
This is what I found, after further investigation: Apparently, the problem is due to the fact that, independent of the condition value, PowerShell will exit with status 0 (successful) if the condition could be tested. The standard workaround seems to be to use if/else conditions to explicitly set exit to 0 or 1, as follows: I tested this command, and it seems to work as expected. 👍 The following hook checks if current hour is between 7h and 23h. No backups are started if this test fails: hooks:
before: >-
$hour = (Get-Date).Hour; if ($hour -ge 7 -and $hour -lt 23) { exit 0 } else { exit 1 }@m3nu: For the Power-Shell "Window-flashing", apparently there is a way to execute PowerShell commands from Rust using "creation_flags" to avoid that the PowerShell Window is created at all. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Testing Vykar 0.16 on Windows 10
I try to specify a before hook. The backup should only run, when the specified condition is "True"
The following command, works well, when I run it directly in the Windows PowerShell:
$hour = (Get-Date).Hour; $hour -ge 7 -and $hour -lt 23This command returns "False" or "True", when I run it in the PowerShell.
When I simply add this command to a before hook, as follows, the hook does not work as expected:
I see two issues:
Is there a way to
Any advice/ hint is welcome.
Beta Was this translation helpful? Give feedback.
All reactions