mirror of
https://github.com/YunoHost-Apps/etherpad_mypads_ynh.git
synced 2024-09-03 18:36:09 +02:00
Update _common.sh
This commit is contained in:
parent
73fbbcb01f
commit
f5117015c9
1 changed files with 0 additions and 22 deletions
|
@ -4,28 +4,6 @@
|
|||
# PERSONAL HELPERS
|
||||
#=================================================
|
||||
|
||||
#=================================================
|
||||
# BACKUP
|
||||
#=================================================
|
||||
|
||||
HUMAN_SIZE () { # Transforme une taille en Ko en une taille lisible pour un humain
|
||||
human=$(numfmt --to=iec --from-unit=1K $1)
|
||||
echo $human
|
||||
}
|
||||
|
||||
CHECK_SIZE () { # Vérifie avant chaque backup que l'espace est suffisant
|
||||
file_to_analyse=$1
|
||||
backup_size=$(du --summarize "$file_to_analyse" | cut -f1)
|
||||
free_space=$(df --output=avail "/home/yunohost.backup" | sed 1d)
|
||||
|
||||
if [ $free_space -le $backup_size ]
|
||||
then
|
||||
ynh_print_err "Espace insuffisant pour sauvegarder $file_to_analyse."
|
||||
ynh_print_err "Espace disponible : $(HUMAN_SIZE $free_space)"
|
||||
ynh_die "Espace nécessaire : $(HUMAN_SIZE $backup_size)"
|
||||
fi
|
||||
}
|
||||
|
||||
#=================================================
|
||||
# FUTUR OFFICIAL HELPERS
|
||||
#=================================================
|
||||
|
|
Loading…
Add table
Reference in a new issue