1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/limesurvey_ynh.git synced 2024-09-03 19:36:32 +02:00

[enh] Add backup script

This commit is contained in:
ljf 2017-02-06 00:55:47 +01:00
parent 974870daa5
commit b92d40f1c6

27
scripts/backup Normal file
View file

@ -0,0 +1,27 @@
#!/bin/bash
# causes the shell to exit if any subcommand or pipeline returns a non-zero status
set -e
# Source YNH helpers
. /usr/share/yunohost/helpers
# Get app instance name
app=$YNH_APP_INSTANCE_NAME
# Retrieve arguments
domain=$(sudo yunohost app setting $app domain)
path=$(sudo yunohost app setting $app path)
local_path=$(sudo yunohost app setting $app local_path)
# Copy the app files
ynh_backup "$local_path" "sources"
# Copy the conf files
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" "conf/nginx.conf"
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" "conf/php-fpm.conf"
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" "conf/php-fpm.ini"
# Save database
dbpass=$(ynh_app_setting_get "$app" mysqlpwd)
mysqldump -u "$app" -p"$dbpass" --no-create-db "$app" > ./dump.sql