1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/freshrss_ynh.git synced 2024-09-03 18:36:33 +02:00
freshrss_ynh/scripts/backup
2017-03-05 21:58:01 +01:00

27 lines
669 B
Bash
Executable file

#!/bin/bash
set -eu
# 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
# Source app helpers
. /usr/share/yunohost/helpers
# retrieve useful param
domain=$(ynh_app_setting_get ${APP} domain)
# 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
ynh_mysql_dump_db ${APP} > ${BACKUP_DIR}/${APP}.dmp