You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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}/audio/" ]; then
  28. mkdir -m 775 -p "${METEOR_OUTPUT}/audio/"
  29. fi
  30. if [ ! -d "${RAMFS_AUDIO}/audio/" ]; then
  31. mkdir -m 775 -p "${RAMFS_AUDIO}/audio/"
  32. fi
  33. if [ ! -d "${NOAA_OUTPUT}/images/thumb" ]; then
  34. mkdir -m 775 -p "${NOAA_OUTPUT}/images/thumb"
  35. fi
  36. if [ ! -d "${NOAA_HOME}/map/" ]; then
  37. mkdir -m 775 -p "${NOAA_HOME}/map/"
  38. fi
  39. if [ ! -d "${NOAA_HOME}/predict/" ]; then
  40. mkdir -m 775 -p "${NOAA_HOME}/predict/"
  41. fi