mirror of
https://github.com/YunoHost-Apps/osjs_ynh.git
synced 2024-09-03 19:56:11 +02:00
Create backup
This commit is contained in:
parent
8ecd4f469a
commit
7dea4a9182
1 changed files with 37 additions and 0 deletions
37
scripts/backup
Normal file
37
scripts/backup
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Exit on command errors and treat unset variables as an error
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
# Source app helpers
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
# Récupère les infos de l'application.
|
||||||
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
# The parameter $1 is the backup directory location dedicated to the app
|
||||||
|
backup_dir=$YNH_APP_BACKUP_DIR
|
||||||
|
|
||||||
|
final_path=$(ynh_app_setting_get $app final_path)
|
||||||
|
domain=$(ynh_app_setting_get $app domain)
|
||||||
|
|
||||||
|
# Copy the app files
|
||||||
|
sudo mkdir -p ${backup_dir}/var/www
|
||||||
|
sudo cp -a $final_path "${backup_dir}/var/www/$app"
|
||||||
|
|
||||||
|
# Backup sources & data
|
||||||
|
sudo mkdir -p "${backup_dir}/sources"
|
||||||
|
sudo cp -a $final_path/* $backup_dir/sources
|
||||||
|
|
||||||
|
# Copy Nginx and YunoHost parameters to make the script "standalone"
|
||||||
|
# Copy the conf files
|
||||||
|
sudo mkdir -p "${backup_dir}/conf"
|
||||||
|
sudo cp -a /etc/nginx/conf.d/$domain.d/$app.conf "${backup_dir}/conf/nginx.conf"
|
||||||
|
sudo mkdir -p "${backup_dir}/yunohost"
|
||||||
|
sudo cp -a /etc/yunohost/apps/$app/. $backup_dir/yunohost
|
||||||
|
|
||||||
|
|
||||||
|
sudo cp -a /etc/systemd/system/${app}.service $backup_dir/
|
||||||
|
|
||||||
|
# Copie du fichier du cron
|
||||||
|
sudo cp -a /etc/cron.d/$app $backup_dir/cron_$app
|
Loading…
Add table
Reference in a new issue