view host/macos/addStartupScriptsPostgres.sh @ 1693:45eaaf5146f3

add backup autostart
author Vadim Filimonov <fffilimonov@yandex.ru>
date Mon, 20 Jun 2022 10:29:43 +0300
parents f53301a50084
children
line wrap: on
line source

#!/bin/bash

SLAVE_IP=$1;

if [ "$1" == "" ]; then
  SLAVE_IP="127.0.0.1";
fi;

. startupScripts.sh;
mkdir -p $localStartup"/postgres" 2>/dev/null;

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 $ROOTPWD/startup/postgres;

cp 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" 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;