view host/addStartupScripts.sh @ 1631:35c626c06dd5

add startup scripts for mac os
author fffilimonov
date Mon, 13 Dec 2021 09:14:52 +0000
parents
children 0344a535b1db
line wrap: on
line source

#!/bin/bash

. startupScripts.sh;

mkdir -p $localStartup 2>/dev/null;
mkdir -p $localStartup/postgres 2>/dev/null;

cleanUp;

cd $startup;
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;

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;

cd $localStartup;
for file in *.plist; do
	sudo ln -sf ${localStartup}/${file} ${systemStarup}/${file};
	sudo chown root:wheel ${localStartup}/${file};
done;


cd $ROOTPWD;