seafile_ynh/scripts/backup
2017-08-09 15:34:10 +02:00

45 lines
No EOL
1.2 KiB
Bash

#!/bin/bash
# Source YunoHost helpers
source /usr/share/yunohost/helpers
# Stop script if errors
ynh_abort_if_errors
# Import common cmd
source ../settings/scripts/_common.sh
# Set configuration for user and final path
get_configuration
# The parameter $1 is the backup directory location dedicated to the app
BACKUP_DIR=$1
# retrieve useful param
domain=$(ynh_app_setting_get ${app} domain)
db_pwd=$(ynh_app_setting_get ${app} mysqlpwd)
# # Backup app files
# mkdir -p "${BACKUP_DIR}/www"
# cp -a $final_path/. "${BACKUP_DIR}/www"
#
# # Backup conf files
# mkdir -p "${BACKUP_DIR}/conf"
# cp -a /etc/nginx/conf.d/$domain.d/${APP}.conf "${BACKUP_DIR}/conf/${APP}.conf"
# cp -a /etc/init.d/seafile-server "${BACKUP_DIR}/conf/seafile-server"
#
# # Backup data
# mkdir -p "${BACKUP_DIR}/data"
# cp -a /home/yunohost.app/seafile-data/. "${BACKUP_DIR}/data"
ynh_backup $final_path
ynh_backup /home/yunohost.app/seafile-data "data" 1
ynh_backup /etc/nginx/conf.d/$domain.d/${app}.conf
ynh_backup /etc/init.d/seafile-server
# Backup mysql
ynh_mysql_dump_db ccnetdb > ${YNH_CWD}/ccnetdb.dmp
ynh_mysql_dump_db seafiledb > ${YNH_CWD}/seafiledb.dmp
ynh_mysql_dump_db seahubdb > ${YNH_CWD}/seahubdb.dmp