Not sure where to begin I only know basic text processing.
I am trying to create a script that will search for zfs snapshots based off a VM name (given as a command parametet) and then select the newest snapshot and finally transfer it to another server.
For example I will run
script.sh 2839
Which will first run
zfs list -t snapshot | grep "vm-2839"
find the following files, and select the newest one based off the date
zfs/backups/vm-2839-disk-0@ZAP_home1_2023-01-20T21:53:29p0000--1d 193M - 11.9G -
zfs/backups/vm-2839-disk-0@ZAP_home1_2023-01-22T11:54:19p0000--1d 18.2M - 11.9G -
zfs/backups/vm-2839-disk-0@ZAP_home1_2023-01-22T16:08:20p0000--1d 0B - 11.9G -
It should then finally send that file to an external server
zfs send zfs/backups/vm-2839-disk-0@ZAP_home1_2023-01-22T16:08:20p0000--1d | ssh [email protected] "zfs receive zfs/vm-2839-disk-0"
zfs …
command line :D Added that tage :)