我正在我的服务器上恢复数据库备份,我需要观察df -h
和恢复实用程序的输出db2pd -utilities
。我试过这个:
watch -n 2 "db2pd -utilities && df -h
输出(总结):
Every 2.0s: db2pd -utilities && df -h
Database Member 0 -- Active -- Up 0 days 23:11:19
Utilities:
Address ID Type State Invoker Priority
0x000000E0 1 RESTORE 0 0 0
Progress:
Address ID PhaseNum CompletedWork
0x00003088 1 1 1073745920 bytes
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 39G 824M 36G 3% /
tmpfs 253G 16K 253G 1% /dev/shm
/dev/sda2 194M 36M 149M 20% /boot
/dev/sda1 200M 264K 200M 1% /boot/efi
/dev/sda4 20G 215M 19G 2% /home
/dev/sda5 20G 1.4G 17G 8% /opt
/dev/sda9 166G 6.6G 151G 5% /tempWork
/dev/sda7 9.7G 152M 9.0G 2% /tmp
/dev/sda6 20G 227M 19G 2% /var
实际上输出越来越长,我不得不删除一些部分,它们结合在一起变得难以阅读。我应该用什么在它们之间腾出空间?
所需要做的就是在原始命令之间添加一个 printf 语句:
watch -n 2 "db2pd -utilities && printf '\n\n\n' && df -h"
您可以使用它grep -v
来隐藏各个实用程序的任何无关数据。