feat(dtic-BKPs): auto-relaunch inside GNU screen

This commit is contained in:
Ricardo Monla
2026-02-23 20:07:05 -03:00
parent ec8bf57e18
commit 2acf1cd416
3 changed files with 36 additions and 8 deletions
+14 -7
View File
@@ -98,15 +98,22 @@ def procesar_backups_tipo_proxmox(tarea_cfg)
archivos_fuente_del_backup = Dir.glob(File.join(dir_origen, "#{nombre_base_log}*"))
ruta_notes = archivos_fuente_del_backup.find { |f| f.end_with?('.notes') }
unless ruta_notes
log :warn, "#{tarea_cfg[:id]}: No se encontró el archivo .notes para '#{nombre_base_log}'. Saltando."
next
nombre_vm = nil
if ruta_notes
nombre_vm = File.read(ruta_notes).strip
end
nombre_vm = File.read(ruta_notes).strip
if nombre_vm.empty?
log :warn, "#{tarea_cfg[:id]}: El archivo .notes para '#{nombre_base_log}' está vacío. Saltando."
next
if nombre_vm.nil? || nombre_vm.empty?
# Fallback: extraemos el ID de la VM del nombre de archivo (ej. vzdump-qemu-101-...)
regex_match = nombre_base_log.match(/vzdump-(?:qemu|lxc)-(\d+)-/)
if regex_match
nombre_vm = "VM-#{regex_match[1]}"
log :info, "#{tarea_cfg[:id]}: Sin .notes válido para '#{nombre_base_log}'. Respaldo asignado a: #{nombre_vm}"
else
log :warn, "#{tarea_cfg[:id]}: No se pudo determinar nombre de VM para '#{nombre_base_log}'. Saltando."
next
end
end
nombre_final_tar = "#{nombre_vm}_#{File.mtime(ruta_log).strftime('%Y%m%d_%H%M%S')}.tar.gz"