mirror of
https://github.com/YunoHost-Apps/seafile_ynh.git
synced 2024-09-03 20:26:01 +02:00
47 lines
1.7 KiB
Bash
47 lines
1.7 KiB
Bash
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC START
|
|
#=================================================
|
|
|
|
# Import common cmd
|
|
source ../settings/scripts/experimental_helper.sh
|
|
source ../settings/scripts/_common.sh
|
|
|
|
# Source YunoHost helpers
|
|
source /usr/share/yunohost/helpers
|
|
|
|
seafile_version=$(ynh_app_upstream_version)
|
|
seafile_code="$install_dir/seafile_image/opt/seafile/seafile-server-$seafile_version"
|
|
|
|
if systemctl is-active seafile --quiet || systemctl is-active seahub --quiet; then
|
|
ynh_print_warn "It's hightly recommended to make your backup when the service is stopped. Please stop seafile service and seahub service with this command before to run the backup 'systemctl stop seafile.service seahub.service'"
|
|
fi
|
|
|
|
#=================================================
|
|
# STANDARD BACKUP STEPS
|
|
#=================================================
|
|
|
|
# # Backup app files
|
|
ynh_print_info "Backing up code..."
|
|
ynh_backup "$install_dir"
|
|
ynh_print_info "Backing up user data..."
|
|
ynh_backup "$data_dir" --dest_path="data"
|
|
|
|
ynh_print_info "Backing up configuration..."
|
|
ynh_backup "/etc/nginx/conf.d/$domain.d/${app}.conf"
|
|
ynh_backup /etc/systemd/system/seafile.service
|
|
ynh_backup /etc/systemd/system/seahub.service
|
|
ynh_backup /etc/fail2ban/jail.d/"$app".conf
|
|
ynh_backup /etc/fail2ban/filter.d/"$app".conf
|
|
|
|
# Backup logs
|
|
ynh_backup "/var/log/$app"
|
|
|
|
# Backup mysql
|
|
ynh_print_info "Backing up database"
|
|
ynh_mysql_dump_db > "${YNH_CWD}"/seafiledb.dmp
|
|
ynh_mysql_dump_db --database=ccnetdb > "${YNH_CWD}"/ccnetdb.dmp
|
|
ynh_mysql_dump_db --database=seahubdb > "${YNH_CWD}"/seahubdb.dmp
|
|
|
|
ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|