2015-11-18 17:22:55 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2017-09-11 08:29:58 +02:00
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
2021-01-11 23:46:48 +01:00
|
|
|
# DECLARE DATA AND CONF FILES TO BACKUP
|
|
|
|
#=================================================
|
|
|
|
ynh_print_info --message="Declaring files to be backed up..."
|
|
|
|
|
2017-09-11 08:29:58 +02:00
|
|
|
#=================================================
|
|
|
|
# BACKUP THE APP MAIN DIR
|
|
|
|
#=================================================
|
2015-11-18 17:22:55 +01:00
|
|
|
|
2023-09-11 21:36:20 +02:00
|
|
|
ynh_backup --src_path="$install_dir"
|
2015-11-18 17:22:55 +01:00
|
|
|
|
2018-01-29 06:45:24 +01:00
|
|
|
#=================================================
|
|
|
|
# BACKUP THE APP DATA
|
|
|
|
#=================================================
|
|
|
|
|
2023-09-11 21:36:20 +02:00
|
|
|
ynh_backup --src_path="$data_dir" --is_big
|
2018-01-29 06:45:24 +01:00
|
|
|
|
2017-09-11 08:29:58 +02:00
|
|
|
#=================================================
|
2021-01-11 23:46:48 +01:00
|
|
|
# BACKUP THE NGINX CONFIGURATION
|
2017-09-11 08:29:58 +02:00
|
|
|
#=================================================
|
2015-11-18 17:22:55 +01:00
|
|
|
|
2021-01-11 23:46:48 +01:00
|
|
|
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
2015-11-18 17:22:55 +01:00
|
|
|
|
2017-09-11 08:29:58 +02:00
|
|
|
#=================================================
|
2021-01-11 23:46:48 +01:00
|
|
|
# BACKUP LOGROTATE
|
2017-09-11 08:29:58 +02:00
|
|
|
#=================================================
|
|
|
|
|
2021-01-11 23:46:48 +01:00
|
|
|
ynh_backup --src_path="/etc/logrotate.d/$app"
|
2017-09-11 08:29:58 +02:00
|
|
|
|
|
|
|
#=================================================
|
2017-10-12 12:47:51 +02:00
|
|
|
# BACKUP SYSTEMD
|
2017-09-11 08:29:58 +02:00
|
|
|
#=================================================
|
|
|
|
|
2021-01-11 23:46:48 +01:00
|
|
|
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
|
|
|
|
|
|
|
#=================================================
|
2021-01-14 12:20:53 +01:00
|
|
|
# BACKUP THE DATABASE
|
2021-01-11 23:46:48 +01:00
|
|
|
#=================================================
|
2023-03-14 11:16:39 +01:00
|
|
|
ynh_print_info --message="Backing up the database..."
|
2021-01-11 23:46:48 +01:00
|
|
|
|
2023-03-14 11:16:39 +01:00
|
|
|
ynh_psql_dump_db --database="$db_name" > db.sql
|
2021-01-11 23:46:48 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|