Improve startup command inotifywait.
This commit is contained in:
parent
a1f8d62549
commit
e8e2761cff
1 changed files with 3 additions and 3 deletions
|
@ -38,12 +38,12 @@ run_nginx() {
|
||||||
run_inotifywait() {
|
run_inotifywait() {
|
||||||
while :; do
|
while :; do
|
||||||
wait_files="$(find "$dstdir" -type f -exec \
|
wait_files="$(find "$dstdir" -type f -exec \
|
||||||
sed -En '/ssl_certificate/ s/^\s*ssl_certificate(_key)? (.*);.*$/\2/p' {} \; | sort | uniq)"
|
sed -En '/ssl_certificate/ s/^\s*ssl_certificate(_key)? (.*);.*$/\2/p' {} \; | sort -u)"
|
||||||
wait_directories="$(echo "$wait_files" | xargs -0 dirname | sort | uniq)"
|
wait_directories="$(echo "$wait_files" | xargs -n 1 dirname | sort -u)"
|
||||||
echo "monitoring the following files:"
|
echo "monitoring the following files:"
|
||||||
echo "$wait_files"
|
echo "$wait_files"
|
||||||
matched_files="$(echo "$wait_directories" | inotifywait --fromfile=- -e close_write -e modify -e create)"
|
matched_files="$(echo "$wait_directories" | inotifywait --fromfile=- -e close_write -e modify -e create)"
|
||||||
if [[ -n "$(comm -12 <(sort <<< "$matched_files") <(echo "$wait_files"))" ]]; then
|
if [[ -n "$(comm -12 <(sort -u <<< "$matched_files") <(echo "$wait_files"))" ]]; then
|
||||||
nginx -s reload
|
nginx -s reload
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in a new issue