garage_ynh/scripts/backup

20 lines
613 B
Bash

#!/bin/bash
# This backup script is adapted to Yunohost >=2.4
# The parameter $1 is the backup directory location dedicated to the app
# which will be compressed afterward
backup_dir=$1
# The parameter $2 is theid of the app instance ex: ynhexample__2
app=$2
# Backup sources & data
final_path=/var/www/$APP
sudo cp -a $final_path "${backup_dir}/www"
# Copy conf file
sudo mkdir -p "${backup_dir}/conf"
domain=$(sudo yunohost app setting $app domain)
sudo cp -a /etc/nginx/conf.d/$domain.d/$app.conf "${backup_dir}/conf/nginx.conf"
# Since Yunohost 2.4 no need to backup settings in /etc/yunohost/apps/$app