| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- #!/bin/bash
- #=================================================
- # GENERIC STARTING
- #=================================================
- # IMPORT GENERIC HELPERS
- #=================================================
- source scripts/_common.sh
- source /usr/share/yunohost/helpers
- #=================================================
- # MANAGE SCRIPT FAILURE
- #=================================================
- # Exit if an error occurs during the execution of the script
- ynh_abort_if_errors
- #=================================================
- # RETRIEVE ARGUMENTS
- #=================================================
- app=$YNH_APP_INSTANCE_NAME
- final_path=$(ynh_app_setting_get --app=$app --key=final_path)
- #=================================================
- # CHECK IF ARGUMENTS ARE CORRECT
- #=================================================
- #=================================================
- # CHECK IF AN ACTION HAS TO BE DONE
- #=================================================
- #=================================================
- # SPECIFIC ACTION
- #=================================================
- # CLEAN ALL BACKUP FILES
- #=================================================
- ynh_script_progression --message="Cleaning all backup files..." --weight=9
- # Get the backup directory from the config file
- backup_dir="$(grep "^backup_dir=" "$final_path/Backup_list.conf" | cut -d= -f2)"
- while read directory <&3
- do
- if [ -n "$directory" ]
- then
- ynh_print_info --message="Clean backup directory $directory"
- ynh_secure_remove --file="$directory"
- fi
- done 3<<< $(find "$backup_dir" -maxdepth 1 -mindepth 1 -type d)
- #=================================================
- # END OF SCRIPT
- #=================================================
- ynh_script_progression --message="Execution completed" --last
|