-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcleanup.sh
executable file
·140 lines (105 loc) · 2.33 KB
/
cleanup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#!/bin/sh
#
#
# ----------------------------------------------------------------------------
# --
# -- Copyright (c) 2018-2022 Silvio Brandani <support@tcapture.net>. All rights reserved.
# --
# ----------------------------------------------------------------------------
# ---------------------------------------------------------------------
# installation script.
# ---------------------------------------------------------------------
#
# Functions
#
# variableInFile()
#
variableInFile () {
variable=${1}
file=${2}
. ${file}
eval value=\$\{${variable}\}
echo ${value}
}
#
# print_usage()
#
print_usage() {
echo ""
echo "Usage: install.sh"
echo ""
}
#
# message()
#
#
# message()
#
message()
{
#echo $*
echo -e ${Yellow}--$Color_Off - ${Green}${*}$Color_Off 2>&1
}
message_date()
{
#echo $*
echo -e ${Yellow}$(date)$Color_Off - ${Green}${*}$Color_Off 2>&1
}
title()
{
#echo $*
echo -e ${Red}${*}$Color_Off 2>&1
}
subtitle()
{
#echo $*
echo -e ${Purple}${*}$Color_Off 2>&1
}
#
# Environment
#
MyPID=$$
SRV=`hostname`
isok=0
# Reset
Color_Off='\e[0m' # Text Reset
# Regular Colors
Black='\e[0;30m' # Nero
Red='\e[0;31m' # Rosso
Green='\e[0;32m' # Verde
Yellow='\e[0;33m' # Giallo
Blue='\e[0;34m' # Blu
Purple='\e[0;35m' # Viola
Cyan='\e[0;36m' # Ciano
White='\e[0;37m' # Bianco
current=`pwd`
# Make sure only root can run our script
if [ "$(id -u)" != "0" ]; then
message "This script must be run as root" 1>&2
exit 1
fi
if [ ! -f TCVer ]; then
message "Please execute install.sh under TCapture software folder (ie: ~/rdbbdr-0.9.6/ !"
exit $STATE_UNKNOWN
fi
echo "export RDBBDR=${current}" > .rdbbdr_env.sh
#Source it
. ${current}/.rdbbdr_env.sh
if [ -z "$RDBBDR" ] ; then
message "RDBBDR HOME not set ! Should be set in .rdbbdr_env.sh"
print_usage
exit $STATE_UNKNOWN
fi
subtitle "Removing TCapture logical decoding library.. "
if [ ! -f /usr/pgsql-10/lib/rdblogdec.so ]; then
message "rdblogdec.so not exists under /usr/pgsql-10/lib"
else
subtitle " Remove TCapture logical decoding library under /usr/pgsql-10/lib"
rm /usr/pgsql-10/lib/rdblogdec.so
fi
subtitle "Removing logs.. "
cd $RDBBDR
rm log/*.log
rm src/TCapt*.log
subtitle "Removing confs.. "
rm conf/*.conf