Няма описание

permanent_data.sh 987B

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/bin/bash
  2. # Wazuh App Copyright (C) 2017, Wazuh Inc. (License GPLv2)
  3. # Variables
  4. source /permanent_data.env
  5. WAZUH_INSTALL_PATH=/var/ossec
  6. DATA_TMP_PATH=${WAZUH_INSTALL_PATH}/data_tmp
  7. mkdir ${DATA_TMP_PATH}
  8. # Move exclusion files to EXCLUSION_PATH
  9. EXCLUSION_PATH=${DATA_TMP_PATH}/exclusion
  10. mkdir ${EXCLUSION_PATH}
  11. for exclusion_file in "${PERMANENT_DATA_EXCP[@]}"; do
  12. # Create the directory for the exclusion file if it does not exist
  13. DIR=$(dirname "${exclusion_file}")
  14. if [ ! -e ${EXCLUSION_PATH}/${DIR} ]
  15. then
  16. mkdir -p ${EXCLUSION_PATH}/${DIR}
  17. fi
  18. mv ${exclusion_file} ${EXCLUSION_PATH}/${exclusion_file}
  19. done
  20. # Move permanent files to PERMANENT_PATH
  21. PERMANENT_PATH=${DATA_TMP_PATH}/permanent
  22. mkdir ${PERMANENT_PATH}
  23. for permanent_dir in "${PERMANENT_DATA[@]}"; do
  24. # Create the directory for the permanent file if it does not exist
  25. DIR=$(dirname "${permanent_dir}")
  26. mkdir -p ${PERMANENT_PATH}${DIR}
  27. cp -ar ${permanent_dir} ${PERMANENT_PATH}${DIR}
  28. done