This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
line=$(tail -1 /var/log/myapp/myapp.uwsgi.log) | |
substr='uWSGI listen queue of socket' | |
if test "${line#*$substr}" != "$line" | |
then | |
#We're using upstart, could be easily adapted to fx systemd | |
# Adding a log statement to keep track of when this happens. Remember to create the monitor dir | |
/sbin/initctl restart myapp > /var/log/myapp/monitor/uwsgi-monitor.log 2>&1 | |
echo "$(date) restarted myapp due to listen queue error" >> /var/log/myapp/monitor/uwsgi-monitor.log |