backup 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/bin/bash
  2. source ../settings/scripts/_common.sh
  3. source /usr/share/yunohost/helpers
  4. ynh_print_info --message="Declaring files to be backed up..."
  5. ynh_backup --src_path="$flohmarkt_install"
  6. ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
  7. ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf"
  8. ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf"
  9. ynh_backup --src_path="/etc/logrotate.d/$app"
  10. ynh_backup --src_path="/opt/couchdb/etc/local.d/05-flohmarkt.ini"
  11. ynh_backup --src_path="/etc/systemd/system/$flohmarkt_filename.service"
  12. ynh_backup --src_path="${flohmarkt_logfile}*"
  13. # for the following backups we'll want to stop flohmarkt and couchdb
  14. # to guarentee a consistant state
  15. ynh_print_info --message="Stopping flohmarkt and couchdb to backup data..."
  16. yunohost service stop $flohmarkt_filename
  17. systemctl stop couchdb
  18. # https://codeberg.org/ChriChri/flohmarkt_ynh/issues/24
  19. # since this might be re-installed as a dependency during 'remove' and
  20. # 'install' anew (like after a failed upgrade) we do not want to use
  21. # --is_big even thought the directories might be big because:
  22. # "don't want that your package does backup that part during ynh_backup_before_upgrade"
  23. # https://yunohost.org/en/packaging_apps_scripts_helpers#ynh-backup
  24. #
  25. # if this becomes a pain we'll need to stop deleting this directories on 'remove'
  26. # ynh_backup --src_path="$data_dir" --is_big
  27. # ynh_backup --src_path="/var/lib/couchdb" --is_big
  28. ynh_backup --src_path="$flohmarkt_data_dir"
  29. ynh_backup --src_path="/var/lib/couchdb"
  30. ynh_print_info --message="...done. Starting couchdb and flohmarkt."
  31. systemctl start couchdb
  32. yunohost service start flohmarkt
  33. ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."