zammad_backup.sh 647 B

1234567891011121314151617181920212223242526272829303132333435363738
  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. # import config
  9. . ${BACKUP_SCRIPT_PATH}/config
  10. else
  11. echo -e "\n The 'config' file is missing!"
  12. echo -e " Please copy ${BACKUP_SCRIPT_PATH}/config.dist to ${BACKUP_SCRIPT_PATH}/config before running $0!\n"
  13. exit 1
  14. fi
  15. # import functions
  16. . ${BACKUP_SCRIPT_PATH}/functions
  17. # exec backup
  18. start_backup_message
  19. get_zammad_dir
  20. check_database_config_exists
  21. delete_old_backups
  22. get_backup_date
  23. backup_dir_create
  24. backup_files
  25. backup_db
  26. finished_backup_message