2015-12-26 14:14:31 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-02-11 01:20:58 +01:00
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
|
2017-07-21 14:56:41 +02:00
|
|
|
# Source YunoHost helpers
|
|
|
|
source /usr/share/yunohost/helpers
|
2015-12-26 14:14:31 +01:00
|
|
|
|
2017-07-21 14:56:41 +02:00
|
|
|
# Stop script if errors
|
|
|
|
ynh_abort_if_errors
|
2017-01-28 18:51:23 +01:00
|
|
|
|
2017-07-21 14:56:41 +02:00
|
|
|
# Import common cmd
|
2018-02-11 01:20:58 +01:00
|
|
|
source ../settings/scripts/experimental_helper.sh
|
2017-07-21 14:56:41 +02:00
|
|
|
source ../settings/scripts/_common.sh
|
2016-12-27 10:44:40 +01:00
|
|
|
|
2019-06-11 22:28:26 +02:00
|
|
|
ynh_script_progression --message="Loading installation settings..."
|
|
|
|
|
2015-12-26 14:14:31 +01:00
|
|
|
# retrieve useful param
|
2019-06-11 22:28:26 +02:00
|
|
|
domain=$(ynh_app_setting_get --app $app --key domain)
|
|
|
|
db_pwd=$(ynh_app_setting_get --app $app --key mysqlpwd)
|
2019-08-05 15:34:00 +02:00
|
|
|
final_path=$(ynh_app_setting_get --app $app --key final_path)
|
|
|
|
seafile_user=$app
|
2015-12-26 14:14:31 +01:00
|
|
|
|
2018-02-11 01:20:58 +01:00
|
|
|
#=================================================
|
|
|
|
# STANDARD BACKUP STEPS
|
|
|
|
#=================================================
|
|
|
|
|
2017-07-21 14:56:41 +02:00
|
|
|
# # Backup app files
|
2019-06-11 22:28:26 +02:00
|
|
|
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"
|
2019-09-10 22:50:07 +02:00
|
|
|
ynh_script_progression --message="Backing up configuration..."
|
2019-06-11 22:28:26 +02:00
|
|
|
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
|
2019-06-12 22:56:50 +02:00
|
|
|
ynh_backup --src_path /etc/fail2ban/jail.d/$app.conf
|
|
|
|
ynh_backup --src_path /etc/fail2ban/filter.d/$app.conf
|
2015-12-26 14:14:31 +01:00
|
|
|
|
|
|
|
# Backup mysql
|
2019-09-10 22:50:07 +02:00
|
|
|
ynh_script_progression --message="Backing up database"
|
2019-06-11 22:28:26 +02:00
|
|
|
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
|