jakob / Postico

Public issue tracking for Postico
https://eggerapps.at/postico/
475 stars 9 forks source link

Add a Post-Disconnect Shell Script option to run a script when the database connection is terminated #883

Open eriknolte opened 3 months ago

eriknolte commented 3 months ago

Enhancement request

It would be nice to have a Post-Disconnect (or Shutdown) Shell Script option like the Pre-Connect Shell Script that runs when the connection to the database is terminated.

My use case it that I use the Pre-Connect Shell Script to start up Google's cloud_sql_proxy in the background and there is no convenient way to stop the process when I disconnect from the database. The proxy is left running until I manually kill it from the command line.

I do something like this in the Pre-Connect

GOOGLE_APPLICATION_CREDENTIALS="$HOME/.credentials/<project>.json"
export GOOGLE_APPLICATION_CREDENTIALS
<gcp-bin>/cloud_sql_proxy -instances=<project>:<region>:<database>=tcp:5432 &

and want to do something like this in the Post-Disconnect

pkill cloud_sql_proxy

What software versions are you using?

Postico version:
2.1.1 (9692)

macOS version:
Sonoma 14.6.1 (23G93)

PostgreSQL version:
PostgreSQL 9.6.24 on x86_64-pc-linux-gnu, compiled by Debian clang version 12.0.1, 64-bit