Как logrotate рассматривает globbing?

В соответствии с Ubuntu и вариантами, это назвало vmlinuz. Таким образом, Ваша командная строка для oprofile становится:

opcontrol --vmlinux=/boot/vmlinuz-`uname -r
5
14.03.2013, 03:45
2 ответа

Это выполнилось три раза, однажды для каждого файла соответствия. В странице справочника существует подсказка:

sharedscripts
       Normally,  prerotate  and postrotate scripts are run for each log which is rotated and the absolute path
       to the log file is passed as first argument to the script. That means a single script may be run  multi-
       ple  times  for  log  file  entries which match multiple files (such as the /var/log/news/* example). If
       sharedscripts is specified, the scripts are only run once, no matter how many logs match the  wildcarded
       pattern,  and  whole  pattern  is  passed  to them.  However, if none of the logs in the pattern require
       rotating, the scripts will not be run at all. If the scripts exit with error, the remaining actions will
       not  be  executed  for  any  logs.  This  option overrides the nosharedscripts option and implies create
       option.

Но конечно, Вы только находите это, после того как Вы знаете для взгляда там. (Кроме того, я экспериментально проверил с logrotate -v ;) )

4
27.01.2020, 20:35

Если это имеет значение logrotate использует glob.h (см.: man 3 glob), который документируется очень хорошо в man 7 glob. Это подобно во многих отношениях для избиения globbing (без расширенного globbing), но это не идентично. В частности, это означает, что поддерживает:

?      match a single character
*      match any string, including the empty string
[...]  match any of the listed characters
[a-z]  match a range of characters
[!...] match any but the listed characters
[:xx:] match various character classes, like [:digit:], [:blank:], etc.

Globbing применяется к каждому компоненту пути отдельно. Как пример, если у меня есть rsyslog сбор сервера журналы от нескольких хостов, я могу использовать logrotate строку файла конфигурации как:

/var/log/host/*/*/syslog {
    rotate 5
    ...
}
6
27.01.2020, 20:35

Теги

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