Automatically backup SeaFile data
and delete old backups
Daily backups will be stored in the /root/backups/ and copies older than 7 days will be automatically deleted.
Make file /root/backup.sh
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
#!/bin/bash #remove old backups find /root/backups/* -mtime +7 -exec rm {} \; #stop seafile /var/www/seafile-server/install/seafile-server-latest/seafile.sh stop /var/www/seafile-server/install/seafile-server-latest/seahub.sh stop #backup seafile storage tar -zcvf /root/backups/backup_cloud_storage_`date +"%Y-%m-%d-%H-%M-%S"`.tar.gz /var/www/seafile-server/cloud_storage #start seafile /var/www/seafile-server/install/seafile-server-latest/seafile.sh start /var/www/seafile-server/install/seafile-server-latest/seahub.sh start |
Change /var/www/seafile-server/install on yours Seafile install path.
Change /var/www/seafile-server/cloud_storage on yours Seafile data path.
In the terminal crontab -e add entry:
1 2 3 |
@daily /bin/bash /root/backup_cloud.sh |
read more about – find
read more about – crontab
read more about – tar
read more about – rm
read more about – find
It works great ! 😉 thanks