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

32 lines
954 B
Text
Raw Normal View History

2018-09-25 19:03:30 +02:00
#!/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
2020-11-16 15:10:12 +01:00
domain=$(ynh_app_setting_get --app="$app" --key=domain)
2018-09-25 19:03:30 +02:00
# definie useful vars
2018-10-18 05:16:40 +02:00
final_path="/opt/yunohost/$app"
2021-11-20 19:05:14 +01:00
data_path="/home/yunohost.app/$app"
2021-11-25 20:31:25 +01:00
log_file="/var/log/$app/$app.log"
path_url="/"
2018-09-25 19:03:30 +02:00
# backup source & conf files
2021-01-17 15:28:51 +01:00
ynh_print_info --message="Declaring files to be backed up..."
2020-08-12 22:22:59 +02:00
ynh_backup --src_path="$final_path"
2021-11-20 19:05:14 +01:00
ynh_backup --src_path="$data_path"
2020-08-12 22:22:59 +02:00
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_backup --src_path="/etc/sudoers.d/$app"
2021-11-21 21:25:39 +01:00
ynh_backup --src_path="/etc/systemd/system/$app.service"
2021-02-20 09:53:53 +01:00
ynh_backup --src_path="/etc/logrotate.d/$app"
2021-11-25 20:31:25 +01:00
ynh_backup --src_path="$(dirname "$log_file")"
2020-11-17 18:20:52 +01:00
2021-01-17 15:28:51 +01:00
ynh_print_info --message="Backup of $app completed"