2016-02-09 00:48:21 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2017-02-14 10:58:25 +01:00
|
|
|
set -eu
|
2016-02-09 00:48:21 +01:00
|
|
|
|
|
|
|
# The parameter $1 is the backup directory location dedicated to the app
|
|
|
|
BACKUP_DIR=$1
|
|
|
|
|
|
|
|
# The parameter $2 is the id of the app instance ex: strut__2
|
|
|
|
APP=$2
|
|
|
|
|
2017-02-14 09:40:18 +01:00
|
|
|
# Source app helpers
|
|
|
|
. /usr/share/yunohost/helpers
|
|
|
|
|
2016-02-09 00:48:21 +01:00
|
|
|
# retrieve useful param
|
2017-02-14 09:40:18 +01:00
|
|
|
domain=$(ynh_app_setting_get ${APP} domain)
|
2016-02-09 00:48:21 +01:00
|
|
|
|
|
|
|
# Backup app files
|
|
|
|
sudo mkdir -p "${BACKUP_DIR}/www"
|
|
|
|
sudo cp -a /var/www/${APP}/. "${BACKUP_DIR}/www"
|
|
|
|
|
|
|
|
# Backup conf files
|
|
|
|
sudo mkdir -p "${BACKUP_DIR}/conf"
|
|
|
|
sudo cp -a /etc/nginx/conf.d/$domain.d/${APP}.conf "${BACKUP_DIR}/conf/${APP}.conf"
|
|
|
|
sudo cp -a /etc/cron.d/${APP} "${BACKUP_DIR}/conf/${APP}"
|
|
|
|
|
|
|
|
# Backup mysql
|
2017-03-05 21:58:01 +01:00
|
|
|
ynh_mysql_dump_db ${APP} > ${BACKUP_DIR}/${APP}.dmp
|