Skip to content

Instantly share code, notes, and snippets.

@btbytes
Created April 6, 2011 14:17
Show Gist options
  • Select an option

  • Save btbytes/905723 to your computer and use it in GitHub Desktop.

Select an option

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.
/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