- exec: rm -fr /var/run/postgresql
- exec: ln -s /shared/postgres_run /var/run/postgresql
- exec: socat /dev/null UNIX-CONNECT:/shared/postgres_run/.s.PGSQL.5432 || exit 0 && echo postgres already running stop container ; exit 1
+ - exec: rm -fr /shared/postgres_run/.s*
+ - exec: rm -fr /shared/postgres_run/*.pid
- file:
path: /etc/service/postgres/run
chmod: "+x"
rm -fr /shared/postgres_data_new
install -d -m 0755 -o postgres -g postgres /shared/postgres_data_new && sudo -u postgres /usr/lib/postgresql/9.3/bin/initdb -D /shared/postgres_data_new || exit 0
apt-get install -y postgresql-9.2
+ /etc/init.d/postgresql stop
+ rm -fr /shared/postgres_data/postmaster.pid
cd ~postgres
+ cp /etc/postgresql/9.2/main/*.conf /shared/postgres_data
+ echo >> /shared/postgres_data/postgresql.conf
+ echo "data_directory = '/shared/postgres_data'" >> /shared/postgres_data/postgresql.conf
sudo -u postgres /usr/lib/postgresql/9.3/bin/pg_upgrade -d /shared/postgres_data -D /shared/postgres_data_new -b /usr/lib/postgresql/9.2/bin -B /usr/lib/postgresql/9.3/bin || exit 1
mv /shared/postgres_data /shared/postgres_data_old
echo -------------------------------------------------------------------------------------
exit 1
fi
- - exec: /root/upgrade_postgres
- exec:
cmd:
- chown -R root /var/lib/postgresql/9.3/main
- chown -R postgres:postgres /shared/postgres_data
- chown -R postgres:postgres /var/run/postgresql
+ - exec: /root/upgrade_postgres
- replace:
filename: "/etc/postgresql/9.3/main/postgresql.conf"
from: "data_directory = '/var/lib/postgresql/9.3/main'"