0

使用以下 barman 命令我们可以看到备份状态,而 STARTED/FAILED 状态表示备份实例创建成功

barman list-backup main-db-server

输出:

main-db-server 20170913T115706 - STARTED
main-db-server 20170913T115214 - STARTED
main-db-server 20170913T114659 - STARTED
main-db-server 20170912T233003 - FAILED
main-db-server 20170912T145147 - Tue Sep 12 14:51:50 2017 - Size: 45.2 MiB - WAL Size: 68.6 KiB
main-db-server 20170912T140611 - Tue Sep 12 14:06:14 2017 - Size: 41.2 MiB - WAL Size: 6.3 MiB
main-db-server 20170912T140430 - Tue Sep 12 14:04:36 2017 - Size: 41.2 MiB - WAL Size: 38.6 KiB

是否有可能以某种方式在 barman 语法之后通过管道传输 tput 命令,以便用红色标记 FAILED/STARTED 行,以便用户可以将这些行识别为坏备份?

例子:

barman list-backup main-db-server |  ... tput setaf 1  ... tput sgr0

备注 - " tput setaf 1 " --> 会将字符涂成红色

4

1 回答 1

0

你可以使用 grep barman list-backup main-db-server | grep -E 'FAILED|STARTED' | ... tput setaf 1 ... tput sgr0

于 2017-12-08T18:31:56.477 回答