From 82fa072ce64ccf0307a650a66c5d578fb749d40f Mon Sep 17 00:00:00 2001 From: magikcypress Date: Wed, 19 Apr 2017 02:37:40 +0200 Subject: [fix] Secret key install + backup correct + restore (need test restore) --- scripts/backup | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'scripts/backup') diff --git a/scripts/backup b/scripts/backup index 6e77acf..bb90997 100644 --- a/scripts/backup +++ b/scripts/backup @@ -3,12 +3,19 @@ # Exit on command errors and treat unset variables as an error set -eu -# Get multi-instances specific variables -app=$YNH_APP_INSTANCE_NAME - +if [ ! -e .fonctions ]; then + # Get file fonction if not been to the current directory + sudo cp ../settings/scripts/.fonctions ./.fonctions + sudo chmod a+rx .fonctions +fi +# Loads the generic functions usually used in the script +source .fonctions # Source app helpers source /usr/share/yunohost/helpers +# Get multi-instances specific variables +app=$YNH_APP_INSTANCE_NAME + # Retrieve app settings domain=$(ynh_app_setting_get "$app" domain) @@ -25,7 +32,7 @@ ynh_backup "/etc/systemd/system/mastodon-streaming.service" "systemd_streaming.s # Backup db sudo su - postgres < mastodon_db.sql +pg_dump --role=mastodon -U postgres --no-password mastodon_production > mastodon_db.sql COMMANDS -ynh_backup "./mastodon_db.sql" "mastodon_db.sql" +ynh_backup "/var/lib/postgresql/${app}_db.sql" "${app}_db.sql" ynh_secure_remove /var/lib/postgresql/mastodon_db.sql \ No newline at end of file -- cgit v1.2.3-70-g09d2