Skip to content

Instantly share code, notes, and snippets.

@jkburges
Last active November 16, 2015 01:11
Show Gist options
  • Save jkburges/929bf4fc9aae2d3993c3 to your computer and use it in GitHub Desktop.
Save jkburges/929bf4fc9aae2d3993c3 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Run as:
# curl -s "<url to this>" | sudo time bash
# As root...
apt-get -y install postgresql-9.4-postgis-2.1
service postgresql stop
chmod 777 /var/log/postgresql
pg_dropcluster --stop 9.4 main
# This first attempt fails on 2-aws-syd copy, but this may be due to the snapshot being inconsistent?
# If it works skip step below...
pg_upgradecluster -k -v 9.4 -m upgrade 9.3 main /mnt/db/1/main.9.4
# Skip if previous step works
rm /mnt/db/1/main/*.conf && pg_upgradecluster -k -v 9.4 -m upgrade 9.3 main /mnt/db/1/main.9.4
chmod 775 /var/log/postgresql
#pg_ctlcluster 9.4 main stop
pg_dropcluster 9.3 main
# Check /etc/postgresql config - to see if dropcluser will run
# mv /mnt/db/1/main /mnt/db/1/main.9.3
#mv /mnt/db/1/main.9.4 /mnt/db/1/main
echo "Now run chef"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment