barman +用红色标记失败/已启动的备份

时间:2017-09-14 10:11:00

标签: linux bash backup tput barman

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

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 ” - >将用红色

绘制字符

1 个答案:

答案 0 :(得分:0)

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