#!/bin/bash #### App file generated with YoloGen, the YunoHost app generator, version . # This is the tutorial version of the app. # It contains extra commands to explain what should be done in case you want to adjust some part of the script. # Once you are done, you may remove them. source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers ynh_print_info "Declaring files to be backed up..." ### N.B. : the following 'ynh_backup' calls are only a *declaration* of what needs ### to be backuped and not an actual copy of any file. The actual backup that ### creates and fill the archive with the files happens in the core after this ### script is called. Hence ynh_backups calls takes basically 0 seconds to run. #================================================= # BACKUP THE APP MAIN DIR #================================================= ynh_backup "$install_dir" #================================================= # BACKUP THE DATA DIR #================================================= # NB: $data_dir is not backuped during safety-backup-before-upgrades, # because the data dir may be huge and we don't want to just yolo-create a 10+ GB archive just for upgrades. # On the other hand, $data_dir is also *not* removed by default in the "app remove" step unless --purge is used # This means that even if the upgrade fails and the backup is restored, the data are still there. ynh_backup "$data_dir" #================================================= # SYSTEM CONFIGURATION #================================================= ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup "/etc/systemd/system/$app.service" ynh_backup "/etc/logrotate.d/$app" #================================================= # BACKUP VARIOUS FILES #================================================= ### For apps with huge logs, you might want to pass --is_big, ### and in restore script, mkdir and pass --not_mandatory to ynh_restore_file. ynh_backup "/var/log/$app/" # TODO: add an option to specify log file #================================================= # END OF SCRIPT #================================================= ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."