zammad_backup.sh 746 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/usr/bin/env bash
  2. #
  3. # zammad backup script
  4. #
  5. PATH=/sbin:/bin:/usr/sbin:/usr/bin:
  6. BACKUP_SCRIPT_PATH="$(dirname $(realpath $0))"
  7. if [ -f "${BACKUP_SCRIPT_PATH}/config" ]; then
  8. # Ensure we're inside of our Backup-Script folder (see issue 2508)
  9. cd "${BACKUP_SCRIPT_PATH}"
  10. # import config
  11. . ${BACKUP_SCRIPT_PATH}/config
  12. else
  13. echo -e "\n The 'config' file is missing!"
  14. echo -e " Please copy ${BACKUP_SCRIPT_PATH}/config.dist to ${BACKUP_SCRIPT_PATH}/config before running $0!\n"
  15. exit 1
  16. fi
  17. # import functions
  18. . ${BACKUP_SCRIPT_PATH}/functions
  19. # exec backup
  20. start_backup_message
  21. get_zammad_dir
  22. check_database_config_exists
  23. delete_old_backups
  24. get_backup_date
  25. backup_dir_create
  26. backup_files
  27. backup_db
  28. finished_backup_message