mirror of
https://github.com/YunoHost-Apps/seafile_ynh.git
synced 2024-09-03 20:26:01 +02:00
48 lines
1.7 KiB
Bash
48 lines
1.7 KiB
Bash
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC START
|
|
#=================================================
|
|
|
|
# Source YunoHost helpers
|
|
source /usr/share/yunohost/helpers
|
|
|
|
# Stop script if errors
|
|
ynh_abort_if_errors
|
|
|
|
# Import common cmd
|
|
source ../settings/scripts/experimental_helper.sh
|
|
source ../settings/scripts/_common.sh
|
|
|
|
ynh_script_progression --message="Loading installation settings..."
|
|
|
|
# Set configuration for user and final path
|
|
get_configuration
|
|
|
|
# retrieve useful param
|
|
domain=$(ynh_app_setting_get --app $app --key domain)
|
|
db_pwd=$(ynh_app_setting_get --app $app --key mysqlpwd)
|
|
|
|
#=================================================
|
|
# STANDARD BACKUP STEPS
|
|
#=================================================
|
|
|
|
# # Backup app files
|
|
ynh_script_progression --message="Backing up code..." --weight=3
|
|
ynh_backup --src_path $final_path
|
|
ynh_script_progression --message="Backing up user data..." --weight=10
|
|
ynh_backup --src_path /home/yunohost.app/seafile-data --dest_path "data"
|
|
ynh_script_progression --message="Backing configuration..."
|
|
ynh_backup --src_path /etc/nginx/conf.d/$domain.d/${app}.conf
|
|
ynh_backup --src_path /etc/systemd/system/seafile.service
|
|
ynh_backup --src_path /etc/systemd/system/seahub.service
|
|
ynh_backup --src_path /etc/fail2ban/jail.d/$app.conf
|
|
ynh_backup --src_path /etc/fail2ban/filter.d/$app.conf
|
|
|
|
# Backup mysql
|
|
ynh_script_progression --message="Backing database"
|
|
ynh_mysql_dump_db --database ccnetdb > ${YNH_CWD}/ccnetdb.dmp
|
|
ynh_mysql_dump_db --database seafiledb > ${YNH_CWD}/seafiledb.dmp
|
|
ynh_mysql_dump_db --database seahubdb > ${YNH_CWD}/seahubdb.dmp
|
|
|
|
ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --last
|