1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/photoprism_ynh.git synced 2024-09-03 19:56:41 +02:00

Update ynh_add_swap

This commit is contained in:
Limezy 2022-06-06 00:25:26 +07:00
parent ccf4c09a4d
commit c3a45d636a

View file

@ -48,14 +48,13 @@ ynh_add_swap () {
echo $swap_size echo $swap_size
echo $() echo $()
# If there's enough space for a swap, and no existing swap here # If there's enough space for a swap, and no existing swap here
if [[ $swap_size -ne 0 ]] #&& [[ ! -e /swap_$app ]] if [[ $swap_size -ne 0 ]] && [[ ! -e /swap_$app ]]
then then
echo "OK ici"
# Create file # Create file
truncate -s 0 /swap_$app truncate -s 0 /swap_$app
# set the No_COW attribute on the swapfile with chattr # set the No_COW attribute on the swapfile with chattr
chattr +C /swap_$app #chattr +C /swap_$app
# Preallocate space for the swap file, fallocate may sometime not be used, use dd instead in this case # Preallocate space for the swap file, fallocate may sometime not be used, use dd instead in this case
if ! fallocate -l ${swap_size}K /swap_$app if ! fallocate -l ${swap_size}K /swap_$app