Strange pg_ctl behavior: postmaster shuts down on shell interrupt - Mailing list pgsql-general

From smartdude
Subject Strange pg_ctl behavior: postmaster shuts down on shell interrupt
Date
Msg-id 1159423924.390447.275280@e3g2000cwe.googlegroups.com
Whole thread Raw
Responses Re: Strange pg_ctl behavior: postmaster shuts down on shell interrupt
List 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.


pgsql-general by date:

Previous
From: "blackjadelin"
Date:
Subject: Re: cannt setup postgresql database for my opennms
Next
From: "David Cressey"
Date:
Subject: Re: cyclical redundancy checksum algorithm(s)?