SHELL=/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
MAILTO=mail-root@yandex-team.ru

*/5 * * * * root sleep $((RANDOM \% 120)); for file in $(find /etc/pgbouncer/ -type f | grep -v /etc/pgbouncer/pgbouncer.ini); do pidfile=$(grep '^pidfile = ' ${file} | awk '{print $NF}'); socketdir=$(grep '^unix_socket_dir = ' ${file} | awk '{print $NF}'); if [ ! -z $pidfile ]; then if kill -0 $(cat ${pidfile}) >/dev/null 2>&1; then if ! ls $socketdir/.*PGSQL* >/dev/null 2>&1; then kill $(cat ${pidfile}) >/dev/null 2>/dev/null; fi; fi; fi; done
