Thread: postmaster link to postgres executable

postmaster link to postgres executable

From
imoir@templetech.com
Date:
Hello

Why is the postmaster link to the postgres executable used to run the postgres
server rather than running the postgres executable directly? I have a client
who wishes to use a monitoring application, and the fact that a link to an
executable is used is causing a problem. Can the reference in the linux startup
script be changed from the postmaster file to the postgres file?

Ian



Re: postmaster link to postgres executable

From
Douglas McNaught
Date:
imoir@templetech.com writes:

> Hello
>


> Why is the postmaster link to the postgres executable used to run
> the postgres server rather than running the postgres executable
> directly? I have a client who wishes to use a monitoring
> application, and the fact that a link to an executable is used is
> causing a problem. Can the reference in the linux startup script be
> changed from the postmaster file to the postgres file?

It's a single binary with multiple names, which behaves differently
depending on which name is used to invoke it.  If you start it as
'postmaster', it runs as a daemon and handles incoming connections.
If you invoke it as 'postgres', it starts a "standalone backend",
which is only used for fixing certain rare problems.

So no, invoking it as 'postgres' will keep it from working correctly.

-Doug

Re: postmaster link to postgres executable

From
Martijn van Oosterhout
Date:
I imagine because the name of the program as seen by the kernel (for
example with ps) uses the name the program was started with, not the
name of the actual binary. That way you can use the same binary for
multiple purposes.

If the link causes you a problem, replace the link with a copy of the
file, it won't change anything much.

BTW, it's an odd system that doesn't like links to programs. For
example, my system has the following:

/bin/sh -> bash
/sbin/modprobe -> insmod
/sbin/lsmod -> insmod
/sbin/ksyms -> insmod
/sbin/kallsyms -> insmod
/sbin/swapoff -> swapon
/sbin/reboot -> halt
/sbin/poweroff -> halt
/usr/bin/jmacs -> joe
/usr/bin/jstar -> joe
/usr/bin/i386-linux-gcc-3.3 -> gcc-3.3
/usr/bin/i486-linux-gcc-3.3 -> gcc-3.3
/usr/bin/i386-linux-g++-3.3 -> g++-3.3
/usr/bin/i486-linux-g++-3.3 -> g++-3.3

 and hundreds more. It's not exactly uncommon...

On Wed, Jul 06, 2005 at 02:20:11PM -0700, imoir@templetech.com wrote:
> Why is the postmaster link to the postgres executable used to run the postgres
> server rather than running the postgres executable directly? I have a client
> who wishes to use a monitoring application, and the fact that a link to an
> executable is used is causing a problem. Can the reference in the linux startup
> script be changed from the postmaster file to the postgres file?

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

Attachment

Re: postmaster link to postgres executable

From
Tom Lane
Date:
imoir@templetech.com writes:
> Why is the postmaster link to the postgres executable used to run the postgres
> server rather than running the postgres executable directly? I have a client
> who wishes to use a monitoring application, and the fact that a link to an
> executable is used is causing a problem. Can the reference in the linux startup
> script be changed from the postmaster file to the postgres file?

No.  You could replace the soft link by a hard link if that would help.

            regards, tom lane