nginx.check-reload.sh 557 B

12345678910111213141516171819
  1. #!/bin/sh
  2. #
  3. # Legacy action script to visually check if nginx fails to reload
  4. prog=nginx
  5. pidfile=`/usr/bin/systemctl show -p PIDFile nginx.service | sed 's/^PIDFile=//' | tr ' ' '\n'`
  6. CHECKSLEEP=3
  7. templog=`/bin/mktemp --tmpdir nginx-check-reload-XXXXXX.log`
  8. trap '/bin/rm -f $templog' 0
  9. /usr/bin/tail --pid=$$ -n 0 --follow=name /var/log/nginx/error.log > $templog &
  10. /bin/sleep 1
  11. /bin/echo -n $"Sending reload signal to $prog: "
  12. pkill -F ${pidfile} ${prog} --signal HUP
  13. /bin/echo
  14. /bin/sleep $CHECKSLEEP
  15. /bin/grep -E "\[emerg\]|\[alert\]" $templog
  16. exit 0