|
From: Thomas G. <to...@ad...> - 2001-08-19 11:16:20
|
On Sun, 19 Aug 2001, Jeff Kowalczyk wrote: > It turned out that the way (and a simple one at that) to get postmaster > listening on 5432 with my RH7.1/Pg7.1 combination was to use the > postgresql.conf option "tcpip_socket=true". That accomplished the same > thing as '-i'. I don't know if the .conf file is a relatively new idiom > to postgres, as most of the docs don't refer to it. > > One for the FAQ, I guess. Jeff, Here are two other approaches. 1) You could tweak your /etc/inittab like so: db:5432:respawn:/bin/su - postgres -c "/usr/local/pgsql/bin/postmaster -i -D/usr/local/pgsql/data >> /usr/local/pgsql/postlog 2>&1" > /dev/null Then add a line to your rc.local: rm -f /tmp/.s.PGSQL.5432 in case of unplanned shutdown (this prevents the respawn errors) 2) Alternately, use your own script: #!/bin/sh # SQL Clinic --- Version 1.0.0 # Thomas Good <www.sqlclinic.net> # ident: /usr/local/clinic/pg_start echo -n "Starting postgres service..." echo "nohup postmaster -i > /home/postgres/postgres.log 2>&1 &" | su - postgres sleep 1 pid=`pidof postmaster` echo -e "postmaster: pid [$pid] started..." The advantage of rolling your own is that: a) when you upgrade or move to a new box you take your utilities with you - and - b) I have logging enabled in both approaches (most sql-ledger errors wind up in apache's error_log but I use Pg for other things too.) These scripts assume that Pg env vars are set and that postgres' home is /home/postgres. Cheers... Oh. Almost forgot...here's a shutdown script: #!/bin/sh # ident: /usr/local/clinic/pg_stop echo -n "Stopping postgres service..." pid=`pidof postmaster` if [ "$pid" != "" ] ; then echo -n "postmaster: pid [$pid] killed." kill -TERM $pid sleep 1 fi -------------------------------------------------------------------- SVCMC - Center for Behavioral Health -------------------------------------------------------------------- Thomas Good tomg@ { admin | q8 } .nrnet.org Programmer/Analyst Phone: 718-354-5528 Residential Services Mobile: 917-282-7359 -------------------------------------------------------------------- /* Die Wahrheit Ist Irgendwo Da Draussen... */ -------------------------------------------------------------------- |