1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/transmission_ynh.git synced 2024-09-04 01:46:12 +02:00
transmission_ynh/scripts/backup

65 lines
1.9 KiB
Text
Raw Normal View History

2016-05-14 10:06:20 +02:00
#!/bin/bash
2017-06-13 23:37:51 +02:00
#=================================================
# GENERIC STARTING
#=================================================
# MANAGE FAILURE OF THE SCRIPT
#=================================================
# Exit on command errors and treat unset variables as an error
set -eu
2016-05-14 10:06:20 +02:00
2017-06-13 23:37:51 +02:00
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
if [ ! -e _common.sh ]; then
2017-08-27 22:01:10 +02:00
# Get the _common.sh file if it's not in the current directory
cp ../settings/scripts/_common.sh ./_common.sh
chmod a+rx _common.sh
2017-06-13 23:37:51 +02:00
fi
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
2016-05-14 10:06:20 +02:00
app=$YNH_APP_INSTANCE_NAME
2017-06-13 23:37:51 +02:00
domain=$(ynh_app_setting_get $app domain)
#=================================================
# STANDARD BACKUP STEPS
#=================================================
# BACKUP OF THE NGINX CONFIGURATION
#=================================================
2017-08-27 22:01:10 +02:00
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
2017-06-13 23:37:51 +02:00
#=================================================
# SPECIFIC BACKUP
#=================================================
# BACKUP TRANSMISSION CONFIGURATION
#=================================================
2017-08-27 22:01:10 +02:00
ynh_backup "/etc/transmission-daemon/settings.json"
2016-05-14 10:06:20 +02:00
2017-06-13 23:37:51 +02:00
#=================================================
# BACKUP DATA
#=================================================
2016-05-14 10:06:20 +02:00
2017-08-27 22:01:10 +02:00
ynh_backup "/usr/share/transmission"
2016-05-14 10:06:20 +02:00
2017-08-27 22:01:10 +02:00
ynh_backup "/var/lib/transmission-daemon"
2017-06-13 23:37:51 +02:00
backup_core_only=$(ynh_app_setting_get $app backup_core_only)
2017-08-27 22:01:10 +02:00
# If backup_core_only have a value in settings.yml, do not backup the data directory
if [ -z $backup_core_only ]
2017-06-13 23:37:51 +02:00
then
CHECK_SIZE "/home/yunohost.transmission"
2017-08-27 22:01:10 +02:00
ynh_backup "/home/yunohost.transmission"
2017-06-13 23:37:51 +02:00
else
echo "Data dir will not saved, because backup_core_only is set." >&2
fi