Strange pg_ctl behavior: postmaster shuts down on shell interrupt

From: "smartdude" <in4tunio(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Strange pg_ctl behavior: postmaster shuts down on shell interrupt
Date: 2006-09-28 06:12:04
Message-ID: 1159423924.390447.275280@e3g2000cwe.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all

We use postgres 8.0.4 for our application on Linux ES3 kernel 2.4.21-4.
We wrote a small shell script for starting postgres, which does little
more than just calling postmaster. We trap interrupt signal in the
shell script to allow postgres to start even if interrupted by the
user. But the trap does not seem to work with postmaster or pg_ctl -
that is, the process shuts down.

#pg_cant_trap.sh
#!/bin/sh
pg_ctl stop && sleep 10 #to stop any earlier instance
trap 'printf "trapped\n"' 2 3
pg_ctl start
pg_ctl status
sleep 10 #interrupt the script at this point
sleep 10
pg_ctl status

Interrupting the script at the mentioned point stops the postmaster.
This behavior is not seen if I replace postmaster by some of my own
shell script or a program, that is it does not stop.

A small thing, but I am interested in knowing how it is possible for
postmaster to behave in this way.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Najib Abi Fadel 2006-09-28 06:15:27 Re: grant select on all tables of schema or database
Previous Message John Sidney-Woollett 2006-09-28 06:09:43 Re: cyclical redundancy checksum algorithm(s)?