#!/bin/sh
# Set a couple of kernel parameters
echo 134217728 > /proc/sys/kernel/shmall
echo 134217728 > /proc/sys/kernel/shmmax
# Start the database server
for LOCATION in `cat /etc/pgsql/locations`; do
  if [ ! -d $LOCATION ]; then
    su - postgres -c '/usr/bin/initdb -D '$LOCATION
  fi
  su - postgres -c '/usr/bin/pg_ctl -D '$LOCATION' start'
done

