diff host/addStartupScriptsPostgres.sh @ 1632:0344a535b1db

add doc
author fffilimonov
date Tue, 14 Dec 2021 07:41:01 +0000
parents
children 665049cffc02
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/host/addStartupScriptsPostgres.sh	Tue Dec 14 07:41:01 2021 +0000
@@ -0,0 +1,29 @@
+#!/bin/bash
+
+SLAVE_IP=$1;
+
+mkdir -p $localStartup/postgres 2>/dev/null;
+. startupScripts.sh;
+
+cd $startupPostgres;
+for file in *.plist; do
+    log=${ROOTPWD}"/logs/startup.${file}.log";
+	sed "s~PWD~${startup}~g;\
+	     s~LOG~${log}~g;\
+	     s~USER~${user}~g;\
+	     s~ROOT~${ROOTPWD}~g" $file > ${localStartup}/${file};
+done;
+
+cd ../;
+
+cp postgres/postgresql.conf ${localStartup}/postgres/postgresql.conf;
+mv /usr/local/var/postgresql@9.5/postgresql.conf /usr/local/var/postgresql@9.5/postgresql.conf.bak;
+ln -sf ${localStartup}/postgres/postgresql.conf /usr/local/var/postgresql@9.5/postgresql.conf;
+
+sed "s/SLAVE_IP/${SLAVE_IP}/g" postgres/pg_hba.conf > ${localStartup}/postgres/pg_hba.conf;
+mv /usr/local/var/postgresql@9.5/pg_hba.conf /usr/local/var/postgresql@9.5/pg_hba.conf.bak;
+ln -sf ${localStartup}/postgres/pg_hba.conf /usr/local/var/postgresql@9.5/pg_hba.conf;
+
+addStartup;
+
+cd $ROOTPWD;