From 2a862d9141a84b612ec2dd109a7f74a2b10ffb91 Mon Sep 17 00:00:00 2001 From: builder Date: Fri, 26 Feb 2021 00:18:20 +0000 Subject: tools scripts moved to linux --- tools/scripts/setup-postgresql.sh | 87 --------------------------------------- 1 file changed, 87 deletions(-) delete mode 100644 tools/scripts/setup-postgresql.sh (limited to 'tools/scripts/setup-postgresql.sh') diff --git a/tools/scripts/setup-postgresql.sh b/tools/scripts/setup-postgresql.sh deleted file mode 100644 index 4e1ee3a..0000000 --- a/tools/scripts/setup-postgresql.sh +++ /dev/null @@ -1,87 +0,0 @@ -#!/bin/sh - -# First we define the function -ConfirmOrExit () -{ - while true - do - echo -n "Please confirm (y or n) :" - read CONFIRM - case $CONFIRM in - y|Y|YES|yes|Yes) break ;; - n|N|no|NO|No) - echo "Aborting - you entered $CONFIRM" - exit - ;; - *) echo "Please enter only y or n" - esac - done - echo "You entered $CONFIRM. Continuing ..." -} - - -# Absolute path to this script, e.g. /home/user/bin/foo.sh -SCRIPT=$(readlink -f "$0") -# Absolute path this script is in, thus /home/user/bin -SCRIPTPATH=$(dirname "$SCRIPT") - -DIR=$(dirname "$SCRIPTPATH"); -DIR_CONF=$DIR"/conf" - -echo "SCRIPT=$SCRIPT"; -echo "SCRIPTPATH=$SCRIPTPATH"; -echo "DIR=$DIR"; -echo "DIR_CONF=$DIR_CONF"; -ConfirmOrExit - -IS_INSTALL=$(prt-get isinst postgresql); -echo $IS_INSTALL; -if [ "$IS_INSTALL" = "package postgresql is installed" ] -then - echo "updating postgresql" - OLD_VERSION=$(prt-get current postgresql); - echo $OLD_VERSION; - - sudo -u postgres pg_dumpall > /srv/pgsql/dump-$OLD_VERSION.sql - - sh /etc/rc.d/postgresql stop - - #extra backup, in case ... - tar --xattrs -zcpf /srv/pgsql/data-$OLD_VERSION.tar.gz \ - --directory=/srv/pgsql/data . - - rm -R /srv/pgsql/data - - prt-get update postgresql - - NEW_VERSION=$(prt-get current postgresql); - echo $NEW_VERSION; - - sudo -u postgres initdb -D /srv/pgsql/data - - rejmerge - #installer overwrite system init script - cp -R $DIR_CONF/etc/rc.d/postgresql /etc/rc.d/ - - sh /etc/rc.d/postgresql start - sleep 5 - - sudo -u postgres psql -d postgres -f /srv/pgsql/dump-$OLD_VERSION.sql - -else - echo "install postgresql and dependencies" - prt-get depinst postgresql - - cp -R $DIR_CONF/etc/rc.d/postgresql /etc/rc.d/ - - mkdir /srv/pgsql/ - touch /var/log/postgresql - chown postgres:postgres /srv/pgsql /var/log/postgresql - - sudo -u postgres initdb -D /srv/pgsql/data - - cp $DIR_CONF/srv/pgsql/data/pg_hba.conf /srv/pgsql/data/ - chown postgres:postgres /srv/pgsql/data/pg_hba.conf -fi - -exit 0; -- cgit 1.4.1-2-gfad0 t&id=06ef635e8a4cbd17e43561809ed58691da6f18d7'>091socket.cc.html
blob: 2c75978ac5994faf761886dec36bf425231a0f5f (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16