Bash -"тайм-аут" с проблемой хвоста

atopиспользует лог-файл/var/log/atop/daily.log

$ cd /var/log/atop/
$ ls
atop_20190430  daily.log

$ cat /var/log/atop/daily.log 
existing file /var/log/atop/atop_20190430 has incompatible header

$ sudo rm atop_20190430

$ sudo systemctl start atop
$ sudo systemctl status atop
● atop.service - Atop advanced performance monitor
   Loaded: loaded (/usr/lib/systemd/system/atop.service; enabled; vendor preset: disabled)
   Active: active (running) since Tue 2019-04-30 22:36:21 BST; 5s ago
     Docs: man:atop(1)
 Main PID: 11429 (atop)
    Tasks: 1 (limit: 2890)
   Memory: 5.1M
   CGroup: /system.slice/atop.service
           └─11429 /usr/bin/atop -R -w /var/log/atop/atop_20190430 600

Apr 30 22:36:21 fedora30-vm systemd[1]: Started Atop advanced performance monitor.

В Debian Linux вы можете заметить, что некоторые atopобновления пакетов имеют соответствующую запись в журнале изменений, показанную ниже :-).

atop sometimes changes the format of the raw log files. In that case, atop -r will not be able to read the files written by previous version. The atopconvert(1) tool can be locally used to convert the old log files.

In postinst, the package checks whether the new atop binary will read the latest raw file and try to convert the file. All other files in /var/log/atop are left unchanged.

0
25.04.2021, 21:56
1 ответ

То, что находится в $(), оценивается оболочкой, поэтому становится

timeout 0.6s "stuff from the file"

, который затем попытается выполниться и потерпит неудачу.

Вы пробовали:

timeout 0.6s tail -f./file.txt | grep -qA2 --line-buffered "detail: " | grep -E -- "$KeyNumbers"
1
28.04.2021, 22:51

Теги

Похожие вопросы