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)
|
2021-11-27 21:27:01 +01:00
|
|
|
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)
|
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"
|