###########################################################################
##  Copyright (C) Wizardry and Steamworks 2017 - License: GNU GPLv3      ##
###########################################################################
 
# Where 9.6 is the postgresql version.
 
check process postgresql with pidfile /var/run/postgresql/9.6-main.pid
	start program = "/etc/init.d/postgresql start"
	stop program = "/etc/init.d/postgresql stop"
	if failed unixsocket /var/run/postgresql/.s.PGSQL.5432 protocol pgsql then restart
	if failed port 5432 protocol pgsql then restart
	# if 5 restarts within 5 cycles then timeout