Created
April 6, 2011 14:17
-
-
Save btbytes/905723 to your computer and use it in GitHub Desktop.
Kill the oldest postgresql idle transaction if there are more than 5 such processes.
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
| /usr/bin/test `/usr/bin/pgrep -f 'idle in transaction' | \ | |
| /usr/bin/wc \-l ` \-gt 5 && /usr/bin/pkill \-o \-f 'idle in transaction' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment