-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmview
executable file
·62 lines (48 loc) · 1.74 KB
/
mview
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
#!/bin/bash
### carregando confs e checagens #########################
source mcore
source mcorecheck
### gera lista recente ###################################
bash mglist
### imprime bancos pgsql disponiveis para dump ###########
function print_pgsql_databases()
{
QTBANCOS=$(cat $NMDBLIST_PGSQL|wc -l)
QTHOSTS=$(cat $NMDBLIST_PGSQL |cut -d: -f1|sort -u|wc -l)
echo -e "\nResultado da verificacao nos bancos PGSQL"
echo -e "Encontrei $QTBANCOS bancos em $QTHOSTS sgbds\n"
echo -n "Deseja visualizar o resultado? Y/N: "
read RESULT
if [ $RESULT == "Y" ] || [ $RESULT == "y" ];then
echo -e "\n--- IP, BANCO, SERVIDOR ---\n"
cat $NMDBLIST_PGSQL|sed 's/\:/ /g'|awk '{ print $1,$4,$5 }'
echo -e "\n--- FIM -------------------\n"
fi
}
### imprime bancos mysql disponiveis para dump ###########
function print_mysql_databases()
{
QTBANCOS=$(cat $NMDBLIST_MYSQL|wc -l)
QTHOSTS=$(cat $NMDBLIST_MYSQL |cut -d: -f1|sort -u|wc -l)
echo -e "\nResultado da verificacao nos bancos MYSQL"
echo -e "Encontrei $QTBANCOS bancos em $QTHOSTS sgbds\n"
echo -n "Deseja visualizar o resultado? Y/N: "
read RESULT
if [ $RESULT == "Y" ] || [ $RESULT == "y" ];then
echo -e "\n--- IP, BANCO, SERVIDOR ---\n"
cat $NMDBLIST_MYSQL|sed 's/\:/ /g'|awk '{ print $1,$4,$5 }'
echo -e "\n--- FIM -------------------\n"
fi
}
function print_databases()
{
# listando mysql
if [ $MYDUMPS == "YES" ];then
print_mysql_databases
fi
# listando pgsql
if [ $PGDUMPS == "YES" ];then
print_pgsql_databases
fi
}
print_databases