Thread: pidof not working for postgresql-8.3 ?

pidof not working for postgresql-8.3 ?

From
Ennio-Sr
Date:
Hi all!

[Running Debian/Lenny powerpc on an iBook.]
After upgrading from postgresql-8.1 to pg_8.3 I lost the capacity to
connect to my databases. I have re-created them using old dump.out files.

Besides that I just found out that 'pidof' doen't seem to work for the
ordinary user, as far as postgresql is concerned, whereas it works
regularly for other processes:

user$ pidof /usr/sbin/apache
19095 19094 19093 19092 19091 19088

user$ pidof /usr/lib/postgresql/8.3/bin/postmaster
[nihil]

Is this a normal behaviour for the new pg_8.3?

Thanks for your attention.
Regards,
    Ennio.

--
[Perche' usare Win$ozz (dico io) se ..."anche uno sciocco sa farlo.    \\?//
 Fa' qualche cosa di cui non sei capace!"   (diceva Henry Miller) ]    (°|°)
 Ricevo solo messaggi Content-Type: plain/text (no html o multipart).   )=(
 !!! --> e-mail a mio nome via OE (M$) sono false  e infette <-- !!!

Re: pidof not working for postgresql-8.3 ?

From
Tom Lane
Date:
Ennio-Sr <nasr.laili@tin.it> writes:
> Besides that I just found out that 'pidof' doen't seem to work for the
> ordinary user, as far as postgresql is concerned, whereas it works
> regularly for other processes:

> user$ pidof /usr/sbin/apache
> 19095 19094 19093 19092 19091 19088

> user$ pidof /usr/lib/postgresql/8.3/bin/postmaster
> [nihil]

> Is this a normal behaviour for the new pg_8.3?

I am not familiar with pidof (doesn't exist on any of my boxen)
but maybe it is looking at real executable names rather than
symlinks?  Try looking for "postgres" instead of "postmaster".

            regards, tom lane

Re: pidof not working for postgresql-8.3 ?

From
Ennio-Sr
Date:
* Tom Lane <tgl@sss.pgh.pa.us> [280208, 23:24]:
> Ennio-Sr <nasr.laili@tin.it> writes:
> > Besides that I just found out that 'pidof' doen't seem to work for the
> > ordinary user, as far as postgresql is concerned, whereas it works
> > regularly for other processes:
> [...]
> > Is this a normal behaviour for the new pg_8.3?
>
> I am not familiar with pidof (doesn't exist on any of my boxen)
> but maybe it is looking at real executable names rather than
> symlinks?  Try looking for "postgres" instead of "postmaster".
>
>             regards, tom lane

Hmm... I'm unlucky you don't use pidof. It's part of the Debian/PowerPC
GNU/Linux 'sysvinit-utils' package and I've been using it since I
learned the essentials of postgres. I call that command in a script just
to make sure postgresql is running before starting some other scripts
which use pg. And it still works nicely on my desktop PC (using PG_7.4).

Back to my iBook and PG_8.3 the results I get are quite intriguing (here
are a few examples, but full results are available on request):

user$ pidof  /usr/lib/postgresql/8.3/bin/postgres
2524 2523 2522 2521 2518

user$ pidof  /usr/lib/postgresql/8.3/bin/postmaster
[nihil]

but, doing the same as root, the result is positive for both (postgres
and postmaster)

On the other hand, this is what happens on my desktop PC, running pg_7.4
under Debian/Etch:

user$ pidof /usr/lib/postgresql/bin/postmaster
5652 5651

user$ pidof /usr/lib/postgresql/bin/postgres   # same as root
[nihil]

user$ pidof /usr/lib/postgresql/7,4/bin/postmaster
5652 5651                        =

user$ pidof /usr/lib/postgresql/7.4/bin/postmaster # same as root
5652 5651 5648

user$ pidof /usr/lib/postgresql/7.4/bin/postgres  # positive if root
[nihil]

-------

Perhaps it depends on the sysvinit-utils version being used with the
desktop (2.86.ds1-38) and iBook (2.86.ds1-53), which I couldn't check as
the downgrading threathened to remove some essential packages and I
didn't feel like running any risk at the moment; but I would
be grateful if anybody familiar with pidof could confirm.

Anyway, thank you Tom, for your time and could you suggest a different
command (to be put in a script) aiming at the same goal?

Regards,
    Ennio

--
[Perche' usare Win$ozz (dico io) se ..."anche uno sciocco sa farlo.   \\?//
 Fa' qualche cosa di cui non sei capace!"  (diceva Henry Miller) ]    (°|°)
[Why use Win$ozz (I say) if ... "even a fool can do that.              )=(
 Do something you aren't good at!" (as Henry Miller used to say) ]

Re: pidof not working for postgresql-8.3 ?

From
Ennio-Sr
Date:
* Tom Lane <tgl@sss.pgh.pa.us> [280208, 23:24]:
> Ennio-Sr <nasr.laili@tin.it> writes:
> > Besides that I just found out that 'pidof' doen't seem to work for the
[...]
------
Perhaps it depends on the sysvinit-utils version being used with the
desktop (2.86.ds1-38) and iBook (2.86.ds1-53), which I couldn't check as
the downgrading threathened to remove some essential packages and I
didn't feel like running any risk at the moment; but I would
be grateful if anybody familiar with pidof could confirm.
------

Hi Tom,
just in case you would like to go further into the question, I
downgraded sysvinit-utils (and hence 'pidof') to the same 2.86.ds1-38
version I use to check running processes on pg_7.4 and got exactly the
same results.
So, this could mean something has changed between pg_7.4 (or pg_8.1 I've
been using for some time without any like problem) and pg_8.3 concerning
the _visibility_ of processes to ordinary user.

Regards,
    Ennio

--
[Perche' usare Win$ozz (dico io) se ..."anche uno sciocco sa farlo.   \\?//
 Fa' qualche cosa di cui non sei capace!"  (diceva Henry Miller) ]    (°|°)
[Why use Win$ozz (I say) if ... "even a fool can do that.              )=(
 Do something you aren't good at!" (as Henry Miller used to say) ]

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

               http://archives.postgresql.org