<commit_before>#!/usr/bin/env bash

if [ `which psql `]; then 
    log "PostgreSQL is found, skipping installation"
    exit 0
fi

if [ -z "$OS" ] ; then
	source <(curl -sSL http://downloads.lappsgrid.org/scripts/sniff.sh)
fi

set -eu
echo "Installing PostgreSQL"
if [[ $OS = redhat* || $OS = centos ]] ; then
	yum install -y https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-redhat96-9.6-3.noarch.rpm
	yum install -y postgresql96-server
elif [[ $OS = ubuntu ]] ; then
	sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
	wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -O - | sudo apt-key add -

	sudo apt-get update
	sudo apt-get install -y postgresql postgresql-contrib
else
	echo "Unrecognized Linux flavor."
	exit 1
fi<commit_msg>Starts the postgresql service<commit_after>#!/usr/bin/env bash

if [ `which psql `]; then 
    log "PostgreSQL is found, skipping installation"
    exit 0
fi

if [ -z "$OS" ] ; then
	source <(curl -sSL http://downloads.lappsgrid.org/scripts/sniff.sh)
fi

set -eu
echo "Installing PostgreSQL"
if [[ $OS = redhat* || $OS = centos ]] ; then
	yum install -y https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-redhat96-9.6-3.noarch.rpm
	yum install -y postgresql96-server
elif [[ $OS = ubuntu ]] ; then
	sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
	wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -O - | sudo apt-key add -

	sudo apt-get update
	sudo apt-get install -y postgresql postgresql-contrib
	
	service postgresql start
	until pg_isready ; do 
		echo "Waiting for PostgreSQL service to start"
		sleep 2
	done
	update-rc.d postgresql default	
else
	echo "Unrecognized Linux flavor."
	exit 1
fi
{'fraction_non_alphanumeric': 0.1418629550321199, 'fraction_numerical': 0.01980728051391863, 'mean_word_length': 3.4080188679245285, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 4, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1261363', 'n_tokens_mistral': 786, 'n_tokens_neox': 727, 'n_words': 183}