1234567891011121314151617181920212223242526272829303132 |
- #!/bin/bash
- export DOLAR='$'
- for fn in `ls /etc/nginx/conf.d/*.conf.tpl`; do
- # remove .conf.tpl
- fnn=${fn:0:(-9)}
- # get the name of file
- name=${fnn##*/}
- # apply uppercase
- name=${name^^}
- # generete string to find
- host_name="HOST_${name}="
- # greo in host.env
- module=$(set | grep ${host_name} | head -1)
- # get the url access
- value=${module##*=}
- # get length
- exist=${#value}
- if [ "${exist}" != "0" ];
- then
- echo "--------------------------------------------------------------------------------------"
- echo "Config file -> " ${fn:0:(-4)}
- # module is installed
- envsubst < $fn > ${fn:0:(-4)}
- cat ${fn:0:(-4)}
- else
- echo "--------------------------------------------------------------------------------------"
- echo "VARIABLE IS NOT DEFINED IN FILE host.env -> $fn"
- fi
- done
- nginx -g "daemon off;"
|