1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/peertube_ynh.git synced 2024-09-03 19:56:29 +02:00

Apply example_ynh on backup

This commit is contained in:
yalh76 2019-04-03 00:50:10 +02:00
parent fe45fff7b4
commit 2cb46b6dbe

View file

@ -6,14 +6,8 @@
# IMPORT GENERIC HELPERS # IMPORT GENERIC HELPERS
#================================================= #=================================================
if [ ! -e _common.sh ]; then #Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
# Get the _common.sh file if it's not in the current directory source ../settings/scripts/_common.sh
cp ../settings/scripts/_common.sh ./_common.sh
cp ../settings/scripts/psql.sh ./psql.sh
chmod a+rx _common.sh psql.sh
fi
source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
source psql.sh source psql.sh
@ -27,6 +21,7 @@ ynh_abort_if_errors
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_print_info "Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
@ -42,18 +37,21 @@ systemctl stop "$app"
#================================================= #=================================================
# BACKUP THE APP MAIN DIR # BACKUP THE APP MAIN DIR
#================================================= #=================================================
ynh_print_info "Backing up the main app directory..."
ynh_backup "$final_path" ynh_backup "$final_path"
#================================================= #=================================================
# BACKUP THE NGINX CONFIGURATION # BACKUP THE NGINX CONFIGURATION
#================================================= #=================================================
ynh_print_info "Backing up nginx web server configuration..."
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# BACKUP THE PostgreSQL DATABASE # BACKUP THE POSTGRESQL DATABASE
#================================================= #=================================================
ynh_print_info "Backing up the PostgreSQL database..."
ynh_psql_dump_db "$db_name" > db.sql ynh_psql_dump_db "$db_name" > db.sql
ynh_backup "db.sql" ynh_backup "db.sql"
@ -63,12 +61,14 @@ ynh_backup "db.sql"
#================================================= #=================================================
# BACKUP LOGROTATE # BACKUP LOGROTATE
#================================================= #=================================================
ynh_print_info "Backing up logrotate configuration..."
ynh_backup "/etc/logrotate.d/$app" ynh_backup "/etc/logrotate.d/$app"
#================================================= #=================================================
# BACKUP SYSTEMD # BACKUP SYSTEMD
#================================================= #=================================================
ynh_print_info "Backing up systemd configuration..."
ynh_backup "/etc/systemd/system/$app.service" ynh_backup "/etc/systemd/system/$app.service"
@ -81,3 +81,9 @@ systemctl enable "$app"
systemctl start "$app" systemctl start "$app"
# App needs time to start # App needs time to start
sleep 30 sleep 30
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."