Red Hat Bugzilla – Bug 60890
log information redirected to /dev/null in the init.d stcript
Last modified: 2007-04-18 12:40:47 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.5) Gecko/20011012
Description of problem:
the log infromation of the server is redirected to /dev/null so for example here
is no way to find out why the server doesn't start.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1.for example a computer crashed
2./sbin/service postgresql start
Actual Results: /var/log/pgsql is empty
Expected Results: cat /var/log/pgsql
Found a pre-existing shared memory block (ID 491520) still in use.
If you're sure there are no old backends still running,
remove the shared memory block with ipcrm(1), or just
There should be used -l otion of pg_ctl for loging e.g.
/etc/rc.d/init.d/postgresql:135: su -l postgres -s /bin/sh -c
"/usr/bin/pg_ctl -l /var/log/pgsql -D $PGDATA -p /usr/bin/postmaster start >
/dev/null 2>&1" < /dev/null
Not a bug as such... it's redirected to /dev/null in order to avoid spewing many
lines of output when successful. I'll think about how to not throw it away if
I agree with tomas, the init script is throwing away *information*, it is up to
me if the "many lines of output when successful" are useful for me or not.
ideally the log information should be in /var/log/pgsql/pgsql.log and be
rotated (like all others daemons)
I don't think four lines of output on startup and three on shutdown constitute "spewing many lines of output". This would really be extremely helpful in debugging
intermittent startup problems. I think assigning this a "low" severity is inappropriate. Perhaps I should file a bug report saying "Postgresql sometimes fails to start at
boot time. I don't have any details because your init script throws away all the output."
> I don't think four lines of output on startup and three on shutdown constitute "spewing many lines of output".
I guess I missed the part about 16 lines of output for every database query. :-(
Still, I think the log information is valuable. I've changed my initscripts and created a logrotate script to keep the output from filling /var.
--- postgresql Mon Jul 29 10:49:44 2002
+++ /etc/init.d/postgresql Mon Jul 29 09:29:07 2002
@@ -125,7 +125,7 @@
#all systems go -- remove any stale lock files
rm -f /tmp/.s.PGSQL.* > /dev/null
echo -n $"Starting postgresql service: "
- su -l postgres -c "/usr/bin/pg_ctl -D $PGDATA -p /usr/bin/postmaster start >/dev/null 2>&1" < /dev/null
+ su -l postgres -c "/bin/touch /var/log/pgsql/pgsql.log; /usr/bin/pg_ctl -D $PGDATA -p /usr/bin/postmaster start >>/var/log/pgsql/pgsql.log 2>&1" < /dev/null
if [ $pid ]
/sbin/service postgresql condrestart
drwx------ 2 postgres postgres 4096 Jul 29 09:05 /var/log/pgsql/
This is currently being worked on and will be fixed in an upcoming release.
Still in version 9.
file (not dir ! ) /var/log/pgsql is touched by RPM postgresql-server but is
still in FC2,
yeah, TWO years ! happy birthdate bug !
Yes, that is the time we've been asking the PostgreSQL community to
provide a way of doing log rotation. Without it the log can crash
your system by filling the disk.
Please post a note to firstname.lastname@example.org asking for a log
rotation mechanism. We have a init script that stores the log in
/var/log ready, just waiting for that to become available.
This is (at long last) done in PostgreSQL 8.0.