Thread: Unrecognized service

Unrecognized service

From
Augori
Date:

Hi Folks,

I set up postgresql on a CentOS 5 Linux months ago. I had a process that ran every night and connected to the database.  Everything was working fine until a few days ago when my process tried to connect and failed.   Now I'm getting:

# service postgresql status
postgresql: unrecognized service

Does this mean it's gone?  Does anyone have any suggestions? 

Thank you.

Re: Unrecognized service

From
Adrian Klaver
Date:
On 04/14/2014 05:33 PM, Augori wrote:
>
> Hi Folks,
>
> I set up postgresql on a CentOS 5 Linux months ago. I had a process that
> ran every night and connected to the database.  Everything was working
> fine until a few days ago when my process tried to connect and failed.
> Now I'm getting:
>
> # service postgresql status
> postgresql: unrecognized service
>
> Does this mean it's gone?  Does anyone have any suggestions?

Does ps ax | grep post show postgres running?

What is the process?

Have there been any updates to software between the time it ran and the
time it started failing?

>
> Thank you.


--
Adrian Klaver
adrian.klaver@aklaver.com


Re: Unrecognized service

From
Augori
Date:
Here's what the ps command gives: 

root@server# ps ax | grep post
 9165 pts/1    S+     0:00 grep post

Does this mean it's not running?

It's certainly possible that software updates have occurred.  There are a lot of people working on this machine, so I'm not aware of which changes have been made lately.  

Do you think I need to reinstall the works and set everything up again?


On Mon, Apr 14, 2014 at 8:48 PM, Adrian Klaver <adrian.klaver@aklaver.com> wrote:
On 04/14/2014 05:33 PM, Augori wrote:

Hi Folks,

I set up postgresql on a CentOS 5 Linux months ago. I had a process that
ran every night and connected to the database.  Everything was working
fine until a few days ago when my process tried to connect and failed.
Now I'm getting:

# service postgresql status
postgresql: unrecognized service

Does this mean it's gone?  Does anyone have any suggestions?

Does ps ax | grep post show postgres running?

What is the process?

Have there been any updates to software between the time it ran and the time it started failing?


Thank you.


--
Adrian Klaver
adrian.klaver@aklaver.com

Re: Unrecognized service

From
Tom Lane
Date:
Augori <augori@gmail.com> writes:
> Here's what the ps command gives:
> root@server# ps ax | grep post
>  9165 pts/1    S+     0:00 grep post

> Does this mean it's not running?

Sure looks that way.

> It's certainly possible that software updates have occurred.  There are a
> lot of people working on this machine, so I'm not aware of which changes
> have been made lately.

If "service" is saying it doesn't know a service it used to know,
then either somebody removed the relevant rc.d file (or more likely
the whole postgresql package), or your filesystem is corrupted.
The former seems more likely.  /var/log/yum.log might be helpful
in affixing blame.

> Do you think I need to reinstall the works and set everything up again?

Well, you definitely need to reinstall the postgresql software, but with
any luck the data directory is still there and you can just start up the
server after reinstalling the missing package(s).  Red Hat's packages
were certainly never configured to remove the data directory on package
deletion, and I don't think Devrim's are either.

If the data directory is gone too, you need to have words with whoever
did that ...

            regards, tom lane


Re: Unrecognized service

From
John R Pierce
Date:
On 4/14/2014 5:33 PM, Augori wrote:
> # service postgresql status
> postgresql: unrecognized service
>
> Does this mean it's gone?  Does anyone have any suggestions?

the 'service' command on rhel/centos/etc runs /etc/rc.d/init.d/$1 $2

so, ls -l /etc/rc.d/init.d/postgres*    and see what the service name
is.   my postgreses are generally postgresql-x.y where x.y is the major
version (9.1, 9.3, etc)



--
john r pierce                                      37N 122W
somewhere on the middle of the left coast



Re: Unrecognized service

From
John R Pierce
Date:
On 4/14/2014 7:17 PM, Augori wrote:
> Here's what the ps command gives:
>
> root@server# ps ax | grep post
>  9165 pts/1    S+     0:00 grep post
>
> Does this mean it's not running?
>
> It's certainly possible that software updates have occurred.  There
> are a lot of people working on this machine, so I'm not aware of which
> changes have been made lately.
>
> Do you think I need to reinstall the works and set everything up again?

rpm -qa |grep postgres



--
john r pierce                                      37N 122W
somewhere on the middle of the left coast



Re: Unrecognized service

From
John R Pierce
Date:
On 4/14/2014 7:34 PM, Tom Lane wrote:
> Augori<augori@gmail.com>  writes:
>> >Here's what the ps command gives:
>> >root@server# ps ax | grep post
>> >  9165 pts/1    S+     0:00 grep post
>> >Does this mean it's not running?
> Sure looks that way.
>
>> >It's certainly possible that software updates have occurred.  There are a
>> >lot of people working on this machine, so I'm not aware of which changes
>> >have been made lately.
> If "service" is saying it doesn't know a service it used to know,
> then either somebody removed the relevant rc.d file (or more likely
> the whole postgresql package), or your filesystem is corrupted.
> The former seems more likely.  /var/log/yum.log might be helpful
> in affixing blame.
>

or maybe you're looking at the wrong server or VM ?



--
john r pierce                                      37N 122W
somewhere on the middle of the left coast



Re: Unrecognized service

From
Adrian Klaver
Date:
On 04/14/2014 07:17 PM, Augori wrote:
> Here's what the ps command gives:
>
> root@server# ps ax | grep post
>   9165 pts/1    S+     0:00 grep post
>
> Does this mean it's not running?

Yes, it is not running.

>
> It's certainly possible that software updates have occurred.  There are
> a lot of people working on this machine, so I'm not aware of which
> changes have been made lately.

The part that has me confused is where you say this started a few days
ago with the failure of the nightly process. So is there anything else
using this database? If so where there any other failures? If not then I
am totally at a loss as what is going on.

>
> Do you think I need to reinstall the works and set everything up again?

Well, per the other,  posts at least the start up scripts.

>
>

--
Adrian Klaver
adrian.klaver@aklaver.com


Re: Unrecognized service

From
Adrian Klaver
Date:
On 04/14/2014 07:52 PM, John R Pierce wrote:
> On 4/14/2014 7:34 PM, Tom Lane wrote:
>> Augori<augori@gmail.com>  writes:
>>> >Here's what the ps command gives:
>>> >root@server# ps ax | grep post
>>> >  9165 pts/1    S+     0:00 grep post
>>> >Does this mean it's not running?
>> Sure looks that way.
>>
>>> >It's certainly possible that software updates have occurred.  There
>>> are a
>>> >lot of people working on this machine, so I'm not aware of which
>>> changes
>>> >have been made lately.
>> If "service" is saying it doesn't know a service it used to know,
>> then either somebody removed the relevant rc.d file (or more likely
>> the whole postgresql package), or your filesystem is corrupted.
>> The former seems more likely.  /var/log/yum.log might be helpful
>> in affixing blame.
>>
>
> or maybe you're looking at the wrong server or VM ?

Yea, that thought just occurred to me also.

When you did the ps ax|grep was that on the machine with the Postgres
server?


>
>
>


--
Adrian Klaver
adrian.klaver@aklaver.com


Re: Unrecognized service

From
Augori
Date:
Hi all,

woohoo!  

service postgresql-9.2 status

(pid  9924) is running...


  It seems that I was looking for the service by the wrong name, as John guessed correcty.    Also, Tom, it's good to know that the data won't necessarily go away if I need to reinstall at some point.  

thank you so much for the messages from all three of you.  Your rapid responses were very encouraging.


On Mon, Apr 14, 2014 at 10:34 PM, John R Pierce <pierce@hogranch.com> wrote:
On 4/14/2014 5:33 PM, Augori wrote:
# service postgresql status
postgresql: unrecognized service

Does this mean it's gone?  Does anyone have any suggestions?

the 'service' command on rhel/centos/etc runs /etc/rc.d/init.d/$1 $2

so, ls -l /etc/rc.d/init.d/postgres*    and see what the service name is.   my postgreses are generally postgresql-x.y where x.y is the major version (9.1, 9.3, etc)



--
john r pierce                                      37N 122W
somewhere on the middle of the left coast



--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Re: Unrecognized service

From
Adrian Klaver
Date:
On 04/14/2014 08:25 PM, Augori wrote:
> Hi all,
>
> woohoo!
>
> service postgresql-9.2 status
>
> (pid  9924) is running...
>
>
>    It seems that I was looking for the service by the wrong name, as
> John guessed correcty.    Also, Tom, it's good to know that the data
> won't necessarily go away if I need to reinstall at some point.

Well that still leaves two questions unanswered.

1) Why did the postgres process not show up in the ps ax output?

2) Why is the nightly process doing a status check on postgresql not
postgresql-9.2 ?

 From the original post:

# service postgresql status
postgresql: unrecognized service



>
> thank you so much for the messages from all three of you.  Your rapid
> responses were very encouraging.
>
>

--
Adrian Klaver
adrian.klaver@aklaver.com


Re: Unrecognized service

From
Augori
Date:
Hi Adrian,

I don't know the answer to #1. Was that a wildcard search?

As for #2, I should have been more clear, that's not a check that it does every night.  I just ran that check when it seemed to be down.  It has been a long time to since I've worked with it, so I didn't correctly recall that I needed to look for postgresql-9.2 and not just postgresql.   The problem came up because the nightly process (a Python script that uses psycopg2) tried to, but couldn't connect to postgresql-9.2 server.  

Does that make more sense?


On Tue, Apr 15, 2014 at 12:08 AM, Adrian Klaver <adrian.klaver@aklaver.com> wrote:
On 04/14/2014 08:25 PM, Augori wrote:
Hi all,

woohoo!

service postgresql-9.2 status

(pid  9924) is running...


   It seems that I was looking for the service by the wrong name, as
John guessed correcty.    Also, Tom, it's good to know that the data
won't necessarily go away if I need to reinstall at some point.

Well that still leaves two questions unanswered.

1) Why did the postgres process not show up in the ps ax output?

2) Why is the nightly process doing a status check on postgresql not postgresql-9.2 ?

From the original post:


# service postgresql status
postgresql: unrecognized service




thank you so much for the messages from all three of you.  Your rapid
responses were very encouraging.



--
Adrian Klaver
adrian.klaver@aklaver.com

Re: Unrecognized service

From
Adrian Klaver
Date:
On 04/17/2014 05:55 PM, Augori wrote:
> Hi Adrian,
>
> I don't know the answer to #1. Was that a wildcard search?

It was a grep of the processes running. You replied with this:

"Here's what the ps command gives:

root(at)server# ps ax | grep post
  9165 pts/1    S+     0:00 grep post"

If postgres was running it should have shown up above. Just seemed to be
at odds with later post:

"
woohoo!

service postgresql-9.2 status

(pid  9924) is running...
"

All I can figure is at some point between the first and second post the
service for Postgres was started again. There just was no mention of
that so I was trying to figure out the sequence of events.

>
> As for #2, I should have been more clear, that's not a check that it
> does every night.  I just ran that check when it seemed to be down.  It
> has been a long time to since I've worked with it, so I didn't correctly
> recall that I needed to look for postgresql-9.2 and not just postgresql.
>    The problem came up because the nightly process (a Python script that
> uses psycopg2) tried to, but couldn't connect to postgresql-9.2 server.
>
> Does that make more sense?

Sort of, if the Python script is the only thing hitting the database.
Otherwise I would have expected other 'users' to notice the database was
down. Furthermore, psycopg2 does not know service names, it connects to
a port, host, database as a user. So unless those where changed I would
expect it to keep on connecting, unless the service was stopped, which
seems to follow what I mention above. At any rate everything worked out.

>
>
> On Tue, Apr 15, 2014 at 12:08 AM, Adrian Klaver
> <adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>> wrote:
>
>     On 04/14/2014 08:25 PM, Augori wrote:
>
>         Hi all,
>
>         woohoo!
>
>         service postgresql-9.2 status
>
>         (pid  9924) is running...
>
>
>             It seems that I was looking for the service by the wrong
>         name, as
>         John guessed correcty.    Also, Tom, it's good to know that the data
>         won't necessarily go away if I need to reinstall at some point.
>
>
>     Well that still leaves two questions unanswered.
>
>     1) Why did the postgres process not show up in the ps ax output?
>
>     2) Why is the nightly process doing a status check on postgresql not
>     postgresql-9.2 ?
>
>      >From the original post:
>
>
>     # service postgresql status
>     postgresql: unrecognized service
>
>
>
>
>         thank you so much for the messages from all three of you.  Your
>         rapid
>         responses were very encouraging.
>
>
>
>     --
>     Adrian Klaver
>     adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>
>
>


--
Adrian Klaver
adrian.klaver@aklaver.com


Re: Unrecognized service

From
Augori
Date:
Hmm no, I wasn't able to find it.  So I definitely didn't restart it in the interim.  

I'm thinking I must have used the command incorrectly since I didn't really understand what it was doing. Maybe I invoked it from the wrong place?  But I was at the root, according to the prompt I pasted, so I don't really understand it either.

root@server# ps ax | grep post





On Thu, Apr 17, 2014 at 10:31 PM, Adrian Klaver <adrian.klaver@aklaver.com> wrote:
On 04/17/2014 05:55 PM, Augori wrote:
Hi Adrian,

I don't know the answer to #1. Was that a wildcard search?

It was a grep of the processes running. You replied with this:


"Here's what the ps command gives:

root(at)server# ps ax | grep post

 9165 pts/1    S+     0:00 grep post"

If postgres was running it should have shown up above. Just seemed to be at odds with later post:


"
woohoo!

service postgresql-9.2 status

(pid  9924) is running...
"

All I can figure is at some point between the first and second post the service for Postgres was started again. There just was no mention of that so I was trying to figure out the sequence of events.



As for #2, I should have been more clear, that's not a check that it
does every night.  I just ran that check when it seemed to be down.  It
has been a long time to since I've worked with it, so I didn't correctly
recall that I needed to look for postgresql-9.2 and not just postgresql.
   The problem came up because the nightly process (a Python script that
uses psycopg2) tried to, but couldn't connect to postgresql-9.2 server.

Does that make more sense?

Sort of, if the Python script is the only thing hitting the database. Otherwise I would have expected other 'users' to notice the database was down. Furthermore, psycopg2 does not know service names, it connects to a port, host, database as a user. So unless those where changed I would expect it to keep on connecting, unless the service was stopped, which seems to follow what I mention above. At any rate everything worked out.



On Tue, Apr 15, 2014 at 12:08 AM, Adrian Klaver
<adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>> wrote:

    On 04/14/2014 08:25 PM, Augori wrote:

        Hi all,

        woohoo!

        service postgresql-9.2 status

        (pid  9924) is running...


            It seems that I was looking for the service by the wrong
        name, as
        John guessed correcty.    Also, Tom, it's good to know that the data
        won't necessarily go away if I need to reinstall at some point.


    Well that still leaves two questions unanswered.

    1) Why did the postgres process not show up in the ps ax output?

    2) Why is the nightly process doing a status check on postgresql not
    postgresql-9.2 ?

     >From the original post:


    # service postgresql status
    postgresql: unrecognized service




        thank you so much for the messages from all three of you.  Your
        rapid
        responses were very encouraging.



    --
    Adrian Klaver
    adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>




--
Adrian Klaver
adrian.klaver@aklaver.com