#check for existence of of listen_address being commented out. #gnumed expected postgresql port PORT=5432 PREFERRED_POSTGRESQLCONF="" echo "CHECKING FOR configuration file problems.." let z=2; TOTAL=4 for x in `find /etc -name "postgresql.conf"`; do let y=0; echo; echo "** CHECKING $x ...";echo; if (( `grep -c ^listen_address $x `!= '0' )); then echo "GOOD : listen_address exists in $x, and it is `grep ^listen_address $x`"; echo; let y=y+1; else echo; echo "BAD : parameter 'listen_addresses' is COMMENTED OUT in file $x" ; echo "AT LINE `grep ^#\ *listen_address $x -n `"; echo; fi; grep -n "^port\ *=\ *$PORT" $x; if (( `grep -c "^port\ *=\ *$PORT" $x` == '0' )); then echo "BAD: WARNING parameter 'port' is not set to $PORT in $x"; echo "if this version of postgresql is used for gnumed, is gnumed configured to `grep "^port" $x` ? "; else echo "GOOD : $x has parameter 'port = $PORT' "; echo; let y=y+1; echo; fi; echo; echo score is $y out of $z; if (( y == z )); then echo "So $x should work with gnumed"; PREFERRED_POSTGRESQLCONF=$x fi; echo "finished CHECKING $x."; echo '-----------------------------------'; done let usable_local_pg_hba_conf=0; HBA_CONF= for x in `find /etc -name "pg_hba.conf"`; do y=`grep "^local\ *all\ *all" $x | grep -c ident\ *sameuser` if (( y == '1' )) ; then echo "BAD : $x has ident sameuser authentication for local unix users. md5 is preferred" elif (( `grep "^local\ *all\ *all" $x | grep -c md5` == '1' )); then echo "GOOD: $x has md5 authentication for local unix users"; let usable_local_pg_hba_conf=1; HBA_CONF="$x $HBA_CONF"; elif (( `grep "^local\ *all\ *all" $x | grep -c trust` == '1' )); then echo "OK : $x has trust authentication for local unix users, ok but md5 preferred"; let usable_local_pg_hba_conf=1; HBA_CONF="$x $HBA_CONF"; else echo "BAD: $x has uncertain authentication for local unix users, not md5 and not trust"; fi done echo tcp_found=0; unix_found=0; for MODE in -x -t; do echo "NOW CHECKING WITH netstat $MODE" let n=0; for x in PGSQL postgres; do echo checking with string $x; y=`netstat $MODE -l | grep $x`; echo $y; if (( `netstat $MODE -l | grep -c $x` != '0' && `netstat $MODE -l -e --numeric-ports | grep $x | grep -c $PORT` != '0' )); then let n=1; fi done; if [[ $MODE == '-x' ]]; then LABEL='unix'; else LABEL='tcp'; fi; if (( n == 0 )) ; then echo "BAD : *** No $LABEL socket found for port $PORT" else echo "GOOD: found a $LABEL socket at port $PORT"; let ${LABEL}_found=1; fi; echo; done let y=0; if [[ unix_found ]];then echo FOUND unix socket at $PORT;let y=y+1;else NO unix socket at $PORT; fi if [[ tcp_found ]]; then echo FOUND tcp socket at $PORT;let y=y+1;else NO tcp socket at $PORT; fi if [[ usable_local_pg_hba_conf ]]; then echo FOUND a usable pg_hba_conf at $HBA_CONF;let y=y+1; fi echo the preferred postgresql.conf file is at $PREFERRED_POSTGRESQLCONF if [[ ${PREFERRED_POSTGRESQLCONF:0:3} != "