Is there a way to start postgresql v907 as non daemon process

Started by Karthikalmost 14 years ago3 messagesgeneral
Jump to latest
#1Karthik
kananth@cisco.com

I have observed by default posgresql 8.x onwards starts as daemon process.
Is there a way to avoid it. I want it to run as normal process. The parent
of the server process should be the process that starts the server instead
of being PID 1 ( init ). Till 7.4.2 ( Which was the older version used by us
) was using running in normal mode. The same behavior is necessary as we
have our watchdog failing to identify that it server is actually running.

( Transcript to help you what I am talking about )

c670e04:rkananth 16] /usr/local/bin/postgres --version
postgres (PostgreSQL) 9.0.7

c670e04:rkananth 11] postgres -D /data/db/postgres
c670e04:rkananth 12] ps -A | grep post
65165 ?? Ss 0:00.01 /usr/local/bin/postgres
65167 ?? Ss 0:00.00 postgres: writer process (postgres)
65168 ?? Ss 0:00.00 postgres: wal writer process (postgres)
65169 ?? Ss 0:00.00 postgres: autovacuum launcher process
(postgres)
65170 ?? Ss 0:00.00 postgres: stats collector process (postgres)
65224 0 S+ 0:00.00 grep post

c670e04:rkananth 14] ps -p 65165 -o ppid
PPID
1

c670e04:rkananth 15] ps 1
PID TT STAT TIME COMMAND
1 ?? SLs 0:00.17 /sbin/init --

I would be happy to provide further information if required.

#2Laurenz Albe
laurenz.albe@cybertec.at
In reply to: Karthik (#1)
Re: Is there a way to start postgresql v907 as non daemon process

Karthik wrote:

I have observed by default posgresql 8.x onwards starts as daemon

process. Is there a way to avoid

it. I want it to run as normal process. The parent of the server

process should be the process that

starts the server instead of being PID 1 ( init ). Till 7.4.2 ( Which

was the older version used by us

) was using running in normal mode. The same behavior is necessary as

we have our watchdog failing to

identify that it server is actually running.

( Transcript to help you what I am talking about )

c670e04:rkananth 16] /usr/local/bin/postgres --version
postgres (PostgreSQL) 9.0.7

c670e04:rkananth 11] postgres -D /data/db/postgres
c670e04:rkananth 12] ps -A | grep post
65165 ?? Ss 0:00.01 /usr/local/bin/postgres
65167 ?? Ss 0:00.00 postgres: writer process (postgres)
65168 ?? Ss 0:00.00 postgres: wal writer process (postgres)
65169 ?? Ss 0:00.00 postgres: autovacuum launcher process

(postgres)

65170 ?? Ss 0:00.00 postgres: stats collector process

(postgres)

65224 0 S+ 0:00.00 grep post

c670e04:rkananth 14] ps -p 65165 -o ppid
PPID
1

c670e04:rkananth 15] ps 1
PID TT STAT TIME COMMAND
1 ?? SLs 0:00.17 /sbin/init --

I would be happy to provide further information if required.

If you really want that, start the PostgreSQL server this way:

$ postgres -D /data/directory &

But can't you teach your watchdog to read the postgresql.pid file?

Yours,
Laurenz Albe

#3Karthik
kananth@cisco.com
In reply to: Laurenz Albe (#2)
Re: Is there a way to start postgresql v907 as non daemon process

Thank you Laurenz,

Even executing

$ postgres -D /data/directory

Used to start server in deamon mode, the reason was the postgres.conf was
having "silent_mode = on" ( freebsd port used to do this ). Got this
solved by sending "silent_mode=off" command line. With this my problem is
solved.

Trying to train my watch dog to look into postmaster.pid is also good idea
but I do not want to work on that as it is working fine.

Regards
Karthik

On 5/25/12 1:50 PM, "Albe Laurenz" <laurenz.albe@wien.gv.at> wrote:

Show quoted text

Karthik wrote:

I have observed by default posgresql 8.x onwards starts as daemon

process. Is there a way to avoid

it. I want it to run as normal process. The parent of the server

process should be the process that

starts the server instead of being PID 1 ( init ). Till 7.4.2 ( Which

was the older version used by us

) was using running in normal mode. The same behavior is necessary as

we have our watchdog failing to

identify that it server is actually running.

( Transcript to help you what I am talking about )

c670e04:rkananth 16] /usr/local/bin/postgres --version
postgres (PostgreSQL) 9.0.7

c670e04:rkananth 11] postgres -D /data/db/postgres
c670e04:rkananth 12] ps -A | grep post
65165 ?? Ss 0:00.01 /usr/local/bin/postgres
65167 ?? Ss 0:00.00 postgres: writer process (postgres)
65168 ?? Ss 0:00.00 postgres: wal writer process (postgres)
65169 ?? Ss 0:00.00 postgres: autovacuum launcher process

(postgres)

65170 ?? Ss 0:00.00 postgres: stats collector process

(postgres)

65224 0 S+ 0:00.00 grep post

c670e04:rkananth 14] ps -p 65165 -o ppid
PPID
1

c670e04:rkananth 15] ps 1
PID TT STAT TIME COMMAND
1 ?? SLs 0:00.17 /sbin/init --

I would be happy to provide further information if required.

If you really want that, start the PostgreSQL server this way:

$ postgres -D /data/directory &

But can't you teach your watchdog to read the postgresql.pid file?

Yours,
Laurenz Albe