clean_backups 970 B

1234567891011121314151617181920212223242526272829
  1. #!/bin/bash
  2. #=================================================
  3. # IMPORT GENERIC HELPERS
  4. #=================================================
  5. source scripts/_common.sh
  6. source /usr/share/yunohost/helpers
  7. #=================================================
  8. # CLEAN ALL BACKUP FILES
  9. #=================================================
  10. ynh_script_progression --message="Cleaning all backup files..." --weight=9
  11. # Get the backup directory from the config file
  12. backup_dir="$(grep "^backup_dir=" "$final_path/Backup_list.conf" | cut -d= -f2)"
  13. while read -r directory <&3; do
  14. if [ -n "$directory" ]; then
  15. ynh_print_info --message="Clean backup directory $directory"
  16. ynh_secure_remove --file="$directory"
  17. fi
  18. done 3<<< $(find "$backup_dir" -maxdepth 1 -mindepth 1 -type d)
  19. #=================================================
  20. # END OF SCRIPT
  21. #=================================================
  22. ynh_script_progression --message="Execution completed" --last