mirror of
https://github.com/YunoHost-Apps/freshrss_ynh.git
synced 2024-09-03 18:36:33 +02:00
cleanup backup and restore scripts
This commit is contained in:
parent
7d0beb1b7d
commit
a6348c3fd9
2 changed files with 12 additions and 10 deletions
|
@ -8,9 +8,11 @@ BACKUP_DIR=$1
|
||||||
# The parameter $2 is the id of the app instance ex: strut__2
|
# The parameter $2 is the id of the app instance ex: strut__2
|
||||||
APP=$2
|
APP=$2
|
||||||
|
|
||||||
|
# Source app helpers
|
||||||
|
. /usr/share/yunohost/helpers
|
||||||
|
|
||||||
# retrieve useful param
|
# retrieve useful param
|
||||||
domain=$(sudo yunohost app setting ${APP} domain)
|
domain=$(ynh_app_setting_get ${APP} domain)
|
||||||
db_pwd=$(sudo yunohost app setting ${APP} mysqlpwd)
|
|
||||||
|
|
||||||
# Backup app files
|
# Backup app files
|
||||||
sudo mkdir -p "${BACKUP_DIR}/www"
|
sudo mkdir -p "${BACKUP_DIR}/www"
|
||||||
|
@ -22,4 +24,4 @@ sudo cp -a /etc/nginx/conf.d/$domain.d/${APP}.conf "${BACKUP_DIR}/conf/${APP}.co
|
||||||
sudo cp -a /etc/cron.d/${APP} "${BACKUP_DIR}/conf/${APP}"
|
sudo cp -a /etc/cron.d/${APP} "${BACKUP_DIR}/conf/${APP}"
|
||||||
|
|
||||||
# Backup mysql
|
# Backup mysql
|
||||||
mysqldump -u ${APP} -p$db_pwd ${APP} | sudo dd of=${BACKUP_DIR}/${APP}.dmp
|
ynh_mysql_dump_db ${APP} ${BACKUP_DIR}/${APP}.dmp
|
||||||
|
|
|
@ -8,14 +8,15 @@ BACKUP_DIR=$1
|
||||||
# The parameter $2 is the id of the app instance ex: strut__2
|
# The parameter $2 is the id of the app instance ex: strut__2
|
||||||
APP=$2
|
APP=$2
|
||||||
|
|
||||||
|
# Source app helpers
|
||||||
|
. /usr/share/yunohost/helpers
|
||||||
|
|
||||||
# retrieve useful param
|
# retrieve useful param
|
||||||
domain=$(sudo yunohost app setting ${APP} domain)
|
domain=$(ynh_app_setting_get ${APP} domain)
|
||||||
db_pwd=$(sudo yunohost app setting ${APP} mysqlpwd)
|
path=$(ynh_app_setting_get ${APP} path)
|
||||||
path=$(sudo yunohost app setting ${APP} path)
|
|
||||||
|
|
||||||
# Check domain/path availability
|
# Check domain/path availability
|
||||||
sudo yunohost app checkurl $domain$path -a ${APP} \
|
sudo yunohost app checkurl $domain$path -a ${APP} || ynh_die "The path ${domain}${path} is not available for app installation."
|
||||||
|| (echo "Path not available: $domain$path" && exit 1)
|
|
||||||
|
|
||||||
# Restore sources & data
|
# Restore sources & data
|
||||||
final_path=/var/www/${APP}
|
final_path=/var/www/${APP}
|
||||||
|
@ -32,8 +33,7 @@ sudo cp -a "${BACKUP_DIR}/conf/${APP}.conf" /etc/nginx/conf.d/$domain.d/${APP}.c
|
||||||
sudo cp -a "${BACKUP_DIR}/conf/${APP}" /etc/cron.d/${APP}
|
sudo cp -a "${BACKUP_DIR}/conf/${APP}" /etc/cron.d/${APP}
|
||||||
|
|
||||||
# Restore mysql dump
|
# Restore mysql dump
|
||||||
sudo su -c "mysql -u ${APP} -p$db_pwd ${APP} < ${BACKUP_DIR}/${APP}.dmp"
|
ynh_mysql_execute_file_as_root "${BACKUP_DIR}/${APP}.dmp" "${APP}"
|
||||||
|
|
||||||
# Reload Nginx, and regenerate SSOwat conf
|
# Reload Nginx, and regenerate SSOwat conf
|
||||||
sudo service nginx reload
|
sudo service nginx reload
|
||||||
sudo yunohost app ssowatconf
|
sudo yunohost app ssowatconf
|
||||||
|
|
Loading…
Add table
Reference in a new issue