zfsnap_fix

This commit is contained in:
Milan Meduna 2019-03-30 21:57:33 +01:00
parent 24cfaec0a9
commit 45e63e31a2
2 changed files with 11 additions and 3 deletions

View file

@ -6,7 +6,8 @@ backup_server_dataset="tank/backups"
backup_server_delete_old_snaps=y backup_server_delete_old_snaps=y
backup_server_number_keep_snaps=31 backup_server_number_keep_snaps=31
#Source server settings NOT CHANGE AFTER FIRST FULL BACKUP! #Source server settings
#DO NOT CHANGE zfsnap_days_keep_snaps AFTER FIRST FULL BACKUP!
zfsnap_enable=y zfsnap_enable=y
zfsnap_days_keep_snaps=7 zfsnap_days_keep_snaps=7

View file

@ -1,13 +1,20 @@
#!/bin/bash #!/bin/bash
( (
flock -n 200 || { echo 'locked via flock on file /var/lock/zfs-backup-mm' ; exit 1; } flock -n 200 || { echo 'locked via flock on file /var/lock/zfs-backup-mm' ; exit 1; }
zfsnap_block () { zfsnap_block () {
IFS='
'
if [ $zfsnap_enable = "y" ]; then if [ $zfsnap_enable = "y" ]; then
for dataset in $source_datasets; for dataset in $source_datasets;
do do
echo "Creating snapshot on "$dataset"" echo "Tuning zfSnap for "$dataset""
zfSnap -d -a "$zfsnap_days_keep_snaps"d "$dataset" for command in $(zfSnap -n -d -zpool28fix -a "$zfsnap_days_keep_snaps"d "$dataset" | grep "$dataset")
do
echo "Doing "$command""
eval "$command";
done
done done
backup_block backup_block
else else