1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/bozon_ynh.git synced 2024-09-03 18:16:09 +02:00
bozon_ynh/scripts/backup
2016-05-23 21:40:55 +02:00

31 lines
893 B
Bash

#! /bin/bash
# causes the shell to exit if any subcommand or pipeline returns a non-zero status
set -e
# causes the shell to exit if you try to use an uninitialised variable
set -u
ynh_version=$(sudo yunohost -v | grep "moulinette:" | cut -d' ' -f2 | cut -d'.' -f1,2)
# retrieve arguments
if [ $ynh_version = "2.4" ]; then
app=$YNH_APP_INSTANCE_NAME
else
app=bozon
fi
save_path=$1
domain=$(sudo yunohost app setting $app domain)
# definie useful vars
parent_path=/var/www
final_path=$parent_path/$app
data_path=/home/yunohost.app/$app
# backup sources & data
sudo cp -R $final_path/. $save_path/www/
sudo cp -R $data_path/. $save_path/datas/
# backup php-fpm, Nginx and YunoHost parameters
sudo cp -a /etc/yunohost/apps/$app/. $save_path/yunohost/
sudo cp -a /etc/nginx/conf.d/$domain.d/$app.conf $save_path/nginx.conf
sudo cp -a /etc/php5/fpm/pool.d/$app.conf $save_path/php-fpm.conf