
service postgresql stop


s=`cat /etc/postgresql/9.6/main/pg_hba.conf | grep "#test sedo"`
echo $s



if [ "x${s}" != "x" ]
then
echo "уже настроили"
else
echo "добавляем строку"

echo "
#test sedo
local   all             postgres                                peer
host    all             all             127.0.0.1/32            trust
" > /etc/postgresql/9.6/main/pg_hba.conf

fi


service postgresql start


psql -h 127.0.0.1 -U postgres -l

if [ $# -eq 0  ]
then 
echo OK
else
echo NO
fi