Seafile – очистка сервера от мусора, потерянных библиотек и файлов

Время от времени серверу требуется очистка от мусора, создаем скрипт:

# vi /home/user/bin/cleanup-seafile.sh

#####
#!/bin/bash 
# Uncomment the following line if you rather want to run the script manually.
# Display usage if the script is not run as root user 
# if [[ $USER != "root" ]]; then 
# echo "This script must be run as root user!" 
# exit 1 
# fi 
# 
# echo "Super User detected!!" 
# read -p "Press [ENTER] to start the procedure, this will stop the seafile server!!" 
##### 

# stop the server echo Stopping the Seafile-Server... 
systemctl stop seafile.service 
systemctl stop seahub.service 
echo Giving the server some time to shut down properly.... 
sleep 20 

# run the cleanup echo Seafile cleanup started... 
/home/www/seafile/seafile-server-latest/seaf-gc.sh 
echo Giving the server some time.... 
sleep 10 

# start the server again echo Starting the Seafile-Server... 
systemctl start seafile.service 
systemctl start seahub.service 
echo Seafile cleanup done!

Делаем исполняемым скрипт:

# chmod +x cleanup-seafile.sh

Создаем задание в cron:

# crontab -e

0 2 * * Sun /home/user/bin/cleanup-seafile.sh

 

image_pdfimage_print

Leave a Reply

Your email address will not be published. Required fields are marked *