Bug #4283
closed"/etc/init.d/rudder-server-root status" returns no pid for postgres on ubuntu
Description
Description:
"/etc/init.d/rudder-server-root status" returns no pid for postgres on ubuntu
Output of script:
# /etc/init.d/rudder-server-root status Apache2 is running (pid 2713). Jetty running pid=3318 rudder-agent[11680]: [INFO] Using /etc/default/rudder-agent for configuration rudder-agent[11683]: [INFO] Using /var/rudder/cfengine-community for CFEngine workdir rudder-agent[11686]: [INFO] All configured CFEngine Community processes are running postgres[]: Running clusters: 9.1/main slapd[11712]: [INFO] Using /etc/default/slapd for configuration slapd[11718]: [INFO] Process slapd is running slapd[11732]: [INFO] Detected suffix: cn=rudder-configuration
The problem:
There is no postmaster process running:
# ps axf | grep postmaster | grep -v grep | cut -d" " -f 2 #
The processes that are running:
# ps axf | grep postgres | grep -v grep 1075 ? S 0:02 /usr/lib/postgresql/9.1/bin/postgres -D /var/lib/postgresql/9.1/main -c config_file=/etc/postgresql/9.1/main/postgresql.conf 1080 ? Ss 0:08 \_ postgres: writer process 1081 ? Ss 0:02 \_ postgres: wal writer process 1082 ? Ss 0:01 \_ postgres: autovacuum launcher process 1083 ? Ss 0:05 \_ postgres: stats collector process 1298 ? Ss 13:21 \_ postgres: rudder rudder 127.0.0.1(51669) idle 3457 ? Ss 0:23 \_ postgres: rudder rudder 127.0.0.1(51743) idle 3500 ? Ss 1:08 \_ postgres: rudder rudder 127.0.0.1(51746) idle
Possible solutions:
# ps axf | grep postgres | grep -v grep | head -1 | cut -d " " -f 2 1075
A cleaner one in my humble opinion:
# head -1 /var/lib/postgresql/9.1/main/postmaster.pid 1075
suggested patch:
--- rudder-server-root.old 2013-12-20 15:46:17.000000000 +0100 +++ rudder-server-root 2013-12-20 16:10:33.000000000 +0100 @@ -59,7 +59,7 @@ /etc/init.d/jetty check | tail -1 /etc/init.d/rudder-agent status # Add PostgreSQL PID to the output -echo -n "postgres[$(ps axf | grep postmaster | grep -v grep | cut -d" " -f 2)]: " +echo -n "postgres[$(head -1 /var/lib/postgresql/9.1/main/postmaster.pid)]: " /etc/init.d/postgresql* status /etc/init.d/slapd status }
Comments:
!!! The above solution is NOT tested on other systems than Ubuntu 12.04.3 LTS !!!
Updated by Dennis Cabooter almost 11 years ago
With the above patch on Ubuntu 12.04.3 LTS, the init script works as expected:
# /etc/init.d/rudder-server-root status Apache2 is running (pid 2713). Jetty running pid=3318 rudder-agent[13063]: [INFO] Using /etc/default/rudder-agent for configuration rudder-agent[13066]: [INFO] Using /var/rudder/cfengine-community for CFEngine workdir rudder-agent[13069]: [INFO] All configured CFEngine Community processes are running postgres[1075]: Running clusters: 9.1/main slapd[13100]: [INFO] Using /etc/default/slapd for configuration slapd[13107]: [INFO] Process slapd is running slapd[13122]: [INFO] Detected suffix: cn=rudder-configuration
Updated by Nicolas CHARLES almost 11 years ago
- Status changed from New to 8
- Assignee set to Matthieu CERDA
- Target version set to 2.6.10
Thank you for this patch. However, it works only on Ubuntu, with a recent version on Ubuntu, so we'll need to find a more cross plateform approach
I like the idea of using the pid
On postgres startup script, the pid is obtained via
eval DATADIR=${POSTGRES_DATADIR:-~postgres/data} PIDFILE=$DATADIR/postmaster.pid
or
pidfile="/var/run/postmaster.${PGPORT}.pid"
given the version or os
Matthieu, you are the expert for this
Updated by Vincent MEMBRÉ almost 11 years ago
- Target version changed from 2.6.10 to 2.6.11
Updated by Matthieu CERDA almost 11 years ago
- Project changed from Rudder to 34
- Status changed from 8 to In progress
- Priority changed from N/A to 4
I'd go for a simpler approach: searching for the postmaster.pid file in /var/lib, and reading from it. It would work on basically any OS :)
Implementing.
Updated by Matthieu CERDA almost 11 years ago
- Target version changed from 2.6.11 to 2.8.3
The "status" argument exists on rudder-server-root only from 2.8 onwards, retargetting.
Updated by Matthieu CERDA almost 11 years ago
- Status changed from In progress to Pending technical review
- Assignee changed from Matthieu CERDA to Jonathan CLARKE
- % Done changed from 0 to 100
- Pull Request set to https://github.com/Normation/rudder-packages/pull/213
PR ready !
Updated by Matthieu CERDA almost 11 years ago
- Status changed from Pending technical review to Pending release
Applied in changeset commit:19bbdd329f32c643cd42631072f3859b8d84cfd0.
Updated by Jonathan CLARKE almost 11 years ago
Applied in changeset commit:b025c2132cc42097016174d7f2ca4f0a7e0623d5.
Updated by Vincent MEMBRÉ over 10 years ago
- Status changed from Pending release to Released
This bug has been fixed in Rudder 2.8.3, which was released today.
Check out:
- The release announcement: http://www.rudder-project.org/pipermail/rudder-announce/2014-March/000079.html
- The full ChangeLog: http://www.rudder-project.org/foswiki/bin/view/System/Documentation:ChangeLog28
- Download information: https://www.rudder-project.org/site/get-rudder/downloads/
Updated by Benoît PECCATTE over 9 years ago
- Project changed from 34 to Rudder
- Category set to Packaging