-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpgxlog.sh
executable file
·64 lines (55 loc) · 1007 Bytes
/
pgxlog.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
#!/bin/sh
. pgcommon.sh
SECS=
OPTS=
LISTARCHSTATUS=false
LISTSUMMARIES=false
usage ()
{
cat <<EOF
$PROGNAME lists files in pg_xlog/pg_wal directory
Usage:
$PROGNAME [OPTIONS] [PGDATA]
Description:
By default, WAL files in pg_xlog/pg_wal are listed once
Options:
-a lists archive status files
-n SECS interval; lists every SECS
-s lists WAL summary files
EOF
}
while [ $# -gt 0 ]; do
case "$1" in
"-?"|--help)
usage
exit 0;;
-a)
OPTS="$OPTS -a"
LISTARCHSTATUS=true;;
-n)
SECS=$2
shift;;
-s)
OPTS="$OPTS -s"
LISTSUMMARIES=true;;
-*)
elog "invalid option: $1";;
*)
update_pgdata "$1";;
esac
shift
done
here_is_installation
pgdata_exists
if [ -z "$SECS" ]; then
# If both -a and -s options are specified, only -a is applied.
if [ "$LISTARCHSTATUS" = "true" ]; then
ls -x $PGARCHSTATUS
elif [ "$LISTSUMMARIES" = "true" ]; then
ls -x $PGSUMMARIES
else
ls -x $PGXLOG
fi
else
watch -n$SECS "pgxlog.sh $OPTS $PGDATA"
fi