1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/homeassistant_ynh.git synced 2024-09-03 19:26:16 +02:00
homeassistant_ynh/scripts/backup
2021-11-27 21:27:01 +01:00

31 lines
1.1 KiB
Bash

#!/bin/bash
# to test the functionnality :
# yunohost backup create -n "homeassistant-test" --apps homeassistant
# yunohost backup delete homeassistant-test
source /usr/share/yunohost/helpers
# manage script failure
ynh_abort_if_errors
# retrieve arguments
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app="$app" --key=domain)
port=$(ynh_app_setting_get --app="$app" --key=port)
final_path=$(ynh_app_setting_get --app="$app" --key=final_path)
data_path=$(ynh_app_setting_get --app="$app" --key=data_path)
log_file=$(ynh_app_setting_get --app="$app" --key=log_file)
path_url=$(ynh_app_setting_get --app="$app" --key=path_url)
python=$(ynh_app_setting_get --app="$app" --key=python)
# backup source & conf files
ynh_print_info --message="Declaring files to be backed up..."
ynh_backup --src_path="$final_path"
ynh_backup --src_path="$data_path"
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_backup --src_path="/etc/sudoers.d/$app"
ynh_backup --src_path="/etc/systemd/system/$app.service"
ynh_backup --src_path="/etc/logrotate.d/$app"
ynh_backup --src_path="$(dirname "$log_file")"
ynh_print_info --message="Backup of $app completed"