hi you could use pgpool-II failover_command to trigger the script what you want to something you can take at http://pgpool.projects.postgresql.org/pgpool-II/doc/pgpool-en.html and pgpool-II works in Master/Slave Mode will meet your requirements best regards jenopob -- View this message in context: http://postgresql.1045698.n5.nabble.com/How-to-auto-swtich-the-roles-of-primary-and-standby-tp4546630p4584948.html Sent from the PostgreSQL - admin mailing list archive at Nabble.com. -- Sent via pgsql-admin mailing list (pgsql-admin@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin