1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/lutim_ynh.git synced 2024-09-03 19:36:24 +02:00
lutim_ynh/scripts/backup

67 lines
2 KiB
Text
Raw Normal View History

2015-11-18 00:28:42 +01:00
#!/bin/bash
2017-03-19 19:16:10 +01:00
#=================================================
# GENERIC STARTING
#=================================================
# MANAGE FAILURE OF THE SCRIPT
#=================================================
# Exit on command errors and treat unset variables as an error
set -eu
2016-11-08 13:33:28 +01:00
2017-03-19 19:16:10 +01:00
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
2017-03-21 00:44:14 +01:00
if [ ! -e _common.sh ]; then
2017-03-19 19:16:10 +01:00
# Rapatrie le fichier de fonctions si il n'est pas dans le dossier courant
2017-03-21 00:44:14 +01:00
sudo cp ../settings/scripts/_common.sh ./_common.sh
sudo chmod a+rx _common.sh
2017-03-19 19:16:10 +01:00
fi
2017-03-21 00:44:14 +01:00
source _common.sh
2016-12-14 16:10:00 +01:00
source /usr/share/yunohost/helpers
2017-03-19 19:16:10 +01:00
#=================================================
# LOAD SETTINGS
#=================================================
app=$YNH_APP_INSTANCE_NAME
2016-12-14 16:10:00 +01:00
final_path=$(ynh_app_setting_get $app final_path)
domain=$(ynh_app_setting_get $app domain)
2015-11-18 00:28:42 +01:00
2017-03-19 19:16:10 +01:00
#=================================================
# STANDARD BACKUP STEPS
#=================================================
# BACKUP OF THE MAIN DIR OF THE APP
#=================================================
CHECK_SIZE "$final_path"
2017-05-24 16:48:26 +02:00
ynh_backup_abstract "$final_path" "sources"
2017-03-19 19:16:10 +01:00
#=================================================
# BACKUP OF THE NGINX CONFIGURATION
#=================================================
2017-05-24 16:48:26 +02:00
ynh_backup_abstract "/etc/nginx/conf.d/$domain.d/$app.conf" "nginx.conf"
2017-03-19 19:16:10 +01:00
#=================================================
# SPECIFIC BACKUP
#=================================================
# BACKUP LOGROTATE
#=================================================
2017-05-24 16:48:26 +02:00
ynh_backup_abstract "/etc/logrotate.d/$app" "logrotate"
2017-03-19 19:16:10 +01:00
#=================================================
# BACKUP SYSTEMD
#=================================================
2017-05-24 16:48:26 +02:00
ynh_backup_abstract "/etc/systemd/system/$app.service" "systemd"
2017-03-19 19:16:10 +01:00
#=================================================
# BACKUP OF THE CRON FILE
#=================================================
2016-05-15 11:36:31 +02:00
2017-05-24 16:48:26 +02:00
ynh_backup_abstract "/etc/cron.d/$app" "cron"