Description of problem: Using a simple perl script: #!/usr/bin/perl if ($< ne 0) { exec ("sudo /var/www/cgi-bin/test.cgi"); } print "Content-Type: text/html\n\n"; system("/etc/init.d/postgresql stop"); sleep 5; system("/etc/init.d/postgresql start"); sleep 10; system("/etc/init.d/httpd restart"); exit 0; works perfecty when executed from command line (as root or via sudo). But when executing via apache/cgi/sudo, postgres/postmaster processes die instantly when httpd is stopped. Version-Release number of selected component (if applicable): Version from RHL7.3+errata. How reproducible: Always. Steps to Reproduce: 1. Create the script above 2. Tweak sudo 3. Run it via apache/cgi Actual results: PostgreSQL dies when httpd is stopped. Expected results: PostgreSQL continues running when httpd is stopped. Additional info: This problem is seems to exists with ucd-snmp as well - it seems that this is somehow related to the fact the PostgreSQL and ucd-snmp both use su in their init scripts. Any patches/workarounds/comments would be highly appreciated.
The problem exists with RHL9, too. The difference between RHL7.3 and RHL9 is that with RHL7.3 httpd restart is completed, with RHL9 not (i.e., httpd is only stopped). But the main point is that why PostgreSQL dies?
So, any news on this one? Or is this the right component?
Trying my luck with another component.
Any news from this? A sole "RTFM" comment would be warmly welcomed, if that's all what's needed!
What user is the CGI script running as? Unless it's root (which you shouldn't run CGI scripts as) this is probably never going to work properly.
I would guess that this is somehow making the postmaster part of the process group for httpd, and that the shutdown method used for httpd sends SIGTERM to the whole process group. (Seems a bit odd though since I'd have thought spawning via "su -c" would put the child process into its own group.) If this theory is correct then adding -S to the postmaster switches in the PG start script (put it in the -o stuff in the pg_ctl start call) might make the difficulty go away. I'm not familiar enough with httpd to ensure I'm reproducing your test case --- could you try this and see? Note that I'd not want to make this change to the official script, as it would interfere with plans to support logging to stderr better. However it might do as a workaround, and anyway we need to be sure we understand the cause of the problem before thinking about "real" solutions.
Red Hat Linux is no longer supported by Red Hat, Inc. If you are still running Red Hat Linux, you are strongly advised to upgrade to a current Fedora Core release or Red Hat Enterprise Linux or comparable. Some information on which option may be right for you is available at http://www.redhat.com/rhel/migrate/redhatlinux/. Red Hat apologizes that these issues have not been resolved yet. We do want to make sure that no important bugs slip through the cracks. If this issue is still present in a current Fedora Core release, please open a new bug with the relevant information. Closing as CANTFIX.