No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 
 
 
 

62 líneas
1.2 KiB

  1. #!/bin/bash
  2. ## debug
  3. # set -x
  4. . "$HOME/.noaa.conf"
  5. declare -A levels=([DEBUG]=0 [INFO]=1 [WARN]=2 [ERROR]=3)
  6. log_level=${LOG_LEVEL}
  7. ## log function
  8. log() {
  9. local log_message=$1
  10. local log_priority=$2
  11. #check if level exists
  12. [[ ${levels[$log_priority]} ]] || return 1
  13. #check if level is enough
  14. (( ${levels[$log_priority]} < ${levels[$log_level]} )) && return 2
  15. #log here
  16. echo "${log_priority} : ${log_message}"
  17. }
  18. ## current date and folder structure
  19. START_DATE=$(date '+%d-%m-%Y %H:%M')
  20. ## sane checks
  21. if [ ! -d "${NOAA_HOME}" ]; then
  22. mkdir -m 775 -p "${NOAA_HOME}"
  23. fi
  24. if [ ! -d "${NOAA_OUTPUT}/audio/" ]; then
  25. mkdir -m 775 -p "${NOAA_OUTPUT}/audio/"
  26. fi
  27. if [ ! -d "${METEOR_OUTPUT}" ]; then
  28. mkdir -m 775 -p "${METEOR_OUTPUT}"
  29. fi
  30. if [ ! -d "${METEOR_OUTPUT}/audio/" ]; then
  31. mkdir -m 775 -p "${METEOR_OUTPUT}/audio/"
  32. fi
  33. if [ ! -d "${RAMFS_AUDIO}/audio/" ]; then
  34. mkdir -m 775 -p "${RAMFS_AUDIO}/audio/"
  35. fi
  36. if [ ! -d "${NOAA_OUTPUT}/images/thumb" ]; then
  37. mkdir -m 775 -p "${NOAA_OUTPUT}/images/thumb"
  38. fi
  39. if [ ! -d "${NOAA_HOME}/map/" ]; then
  40. mkdir -m 775 -p "${NOAA_HOME}/map/"
  41. fi
  42. if [ ! -d "${NOAA_HOME}/predict/" ]; then
  43. mkdir -m 775 -p "${NOAA_HOME}/predict/"
  44. fi