mirror of
https://github.com/YunoHost-Apps/concrete5_ynh.git
synced 2024-09-03 18:25:54 +02:00
Create backup
This commit is contained in:
parent
071674dd6f
commit
98da20f348
1 changed files with 49 additions and 0 deletions
49
scripts/backup
Normal file
49
scripts/backup
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
# This is a multi-instance app, meaning it can be installed several times independently
|
||||||
|
# The id of the app as stated in the manifest is available as $YNH_APP_ID
|
||||||
|
# The instance number is available as $YNH_APP_INSTANCE_NUMBER (equals "1", "2", ...)
|
||||||
|
# The app instance name is available as $YNH_APP_INSTANCE_NAME
|
||||||
|
# - the first time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample
|
||||||
|
# - the second time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample__2
|
||||||
|
# - ynhexample__{N} for the subsequent installations, with N=3,4, ...
|
||||||
|
# The app instance name is probably what you are interested the most, since this is
|
||||||
|
# guaranteed to be unique. This is a good unique identifier to define installation path,
|
||||||
|
# db names, ...
|
||||||
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
# Source YunoHost helpers
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
# Retrieve arguments
|
||||||
|
domain=$(ynh_app_setting_get $app domain)
|
||||||
|
|
||||||
|
### MySQL (remove if not used) ###
|
||||||
|
# If a MySQL database is used:
|
||||||
|
# # Dump the database
|
||||||
|
dbname=$app
|
||||||
|
dbuser=$app
|
||||||
|
dbpass=$(ynh_app_setting_get "$app" mysqlpwd)
|
||||||
|
mysqldump -u "$dbuser" -p"$dbpass" --no-create-db "$dbname" > ./dump.sql
|
||||||
|
### MySQL end ###
|
||||||
|
|
||||||
|
|
||||||
|
# Backup directory location for the app from where the script is executed and
|
||||||
|
# which will be compressed afterward
|
||||||
|
backup_dir=$YNH_APP_BACKUP_DIR
|
||||||
|
|
||||||
|
# Backup sources & data
|
||||||
|
ynh_backup "/var/www/$app" "sources"
|
||||||
|
|
||||||
|
# Copy Nginx conf
|
||||||
|
sudo mkdir -p ./conf
|
||||||
|
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" "conf/nginx.conf"
|
||||||
|
|
||||||
|
### PHP (remove if not used) ###
|
||||||
|
# If a dedicated php-fpm process is used:
|
||||||
|
# # Copy PHP-FPM pool configuration
|
||||||
|
ynh_backup "/etc/php5/fpm/pool.d/${app}.conf" "php-fpm.conf"
|
||||||
|
ynh_backup "/etc/php5/fpm/conf.d/20-$app.ini" "php-fpm.ini"
|
||||||
|
### PHP end ###
|
Loading…
Add table
Reference in a new issue