Actions
Bug #4283
closed"/etc/init.d/rudder-server-root status" returns no pid for postgres on ubuntu
Pull Request:
Severity:
UX impact:
User visibility:
Effort required:
Priority:
Name check:
Fix check:
Regression:
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 !!!
Actions