Hello,
I am trying write a script which restores the latest snapshot for a host/source, on another host.
I haven’t managed to select the latest snapshot, filtered by host name, source path.
Using Windows (batch or Powershell).
For example, here is the output of snapshot list --all:
username1@host1:v:\vm
2021-10-18 08:19:33 EEST k6f9cac979705ff9417fe3f8c0352d4da 60.9 GB drwxrwxrwx files:69 dirs:20 (latest-2,hourly-2)
2021-10-18 10:40:03 EEST k99cee5a785abf50a2e571e9693e7a508 60.9 GB drwxrwxrwx files:69 dirs:20 (latest-1,annual-1,monthly-1,weekly-1,daily-1,hourly-1)
username1@host1:v:\vm-arhiva
2020-10-31 09:16:00 EET k72e23c67a8b57433ed33acdeea1d1420 47.9 GB drwxrwxrwx files:51 dirs:20 (latest-16)
2020-10-31 10:13:00 EET ka2e06eb8d52b15c416afa41eeb0007f1 56.9 GB drwxrwxrwx files:58 dirs:22 (latest-15,monthly-6)
[...]
I try to capture the latest snapshot id for username1@host1:v:\vm (k99cee5…). The best way seems to be to output json and filter in Powershell, but so far I’m unable to do it.
It would be something like:
$json.source.host="host1"
and $json.source.userName="username1"
and $json.source.path="v:\\vm"
then select the latest rootEntry.obj
Here is the an excerpt from the json output:
[
{
"id": "5728d05a2c03fb6e606151bf6cba9de6",
"source":
{
"host": "host1",
"userName": "username1",
"path": "v:\\vm"
},
"description": "",
"startTime": "2021-10-18T08:19:33.2625338+03:00",
"endTime": "2021-10-18T08:33:14.1647751+03:00",
"rootEntry":
{
"name": "vm",
"type": "d",
"mode": "0777",
"mtime": "2021-10-18T08:16:41.4182123+03:00",
"obj": "k6f9cac979705ff9417fe3f8c0352d4da",
"summ":
{
"size": 60877753327,
"files": 69,
"symlinks": 0,
"dirs": 20,
"maxTime": "2021-10-18T08:31:01.0633734+03:00",
"numFailed": 0
}
}
},
...
Full json here: ZeroBin.net