Являются ли поля crontab «день месяца» и «день недели» взаимоисключающими?

Вы можете использовать fc-scanиз пакета fontconfig:

[root@centos7 ~]# fc-scan /usr/share/fonts/liberation/LiberationSerif-Regular.ttf 
Pattern has 22 elts (size 32)
    family: "Liberation Serif"(s)
    familylang: "en"(s)
    style: "Regular"(s)
    stylelang: "en"(s)
    fullname: "Liberation Serif"(s)
    fullnamelang: "en"(s)
    slant: 0(i)(s)
    weight: 80(i)(s)
    width: 100(i)(s)
    foundry: "unknown"(s)
    file: "/usr/share/fonts/liberation/LiberationSerif-Regular.ttf"(s)
    index: 0(i)(s)
    outline: True(s)
    scalable: True(s)
    charset: 
    0000: 00000000 ffffffff ffffffff 7fffffff 00000000 ffffffff ffffffff ffffffff
    0001: ffffffff ffffffff ffffffff ffffffff 00040000 00000000 00000000 fc000000
    0002: 0f000000 00000000 00000000 00000000 00000000 00000000 3f0002c0 00000000
    0003: 00000000 00000000 00000000 40000000 ffffd7f0 fffffffb 00007fff 00000000
    0004: ffffffff ffffffff ffffffff 00000000 00030000 00000000 00000000 00000000
    001e: 00000000 00000000 00000000 00000000 0000003f 00000000 00000000 000c0000
    0020: 7fbb0000 560d0047 00000010 80000000 00000000 00001098 00000000 00000000
    0021: 00480020 00004044 78000000 00000000 003f0000 00000100 00000000 00000000
    0022: c6268044 00000a00 00000100 00000033 00000000 00000000 00000000 00000000
    0023: 00010004 00000003 00000000 00000000 00000000 00000000 00000000 00000000
    0025: 11111005 10101010 ffff0000 00001fff 000f1111 14041c03 03008c10 00000040
    0026: 00000000 1c000000 00000005 00000c69 00000000 00000000 00000000 00000000
    00f0: 00000036 00000000 00000000 00000000 00000000 00000000 00000000 00000000
    00fb: 00000006 00000000 00000000 00000000 00000000 00000000 00000000 00000000
(s)
    lang: aa|af|av|ay|be|bg|bi|br|bs|ca|ce|ch|co|cs|cy|da|de|el|en|eo|es|et|eu|fi|fj|fo|fr|fur|fy|gd|gl|gv|ho|hr|hu|ia|id|ie|ik|io|is|it|ki|kl|kum|la|lb|lez|lt|lv|mg|mh|mk|mo|mt|nb|nds|nl|nn|no|nr|nso|ny|oc|om|os|pl|pt|rm|ro|ru|se|sel|sk|sl|sma|smj|smn|so|sq|sr|ss|st|sv|sw|tk|tl|tn|tr|ts|uk|uz|vo|vot|wa|wen|wo|xh|yap|zu|an|crh|csb|fil|hsb|ht|jv|kj|ku-tr|kwm|lg|li|ms|na|ng|pap-an|pap-aw|rn|rw|sc|sg|sn|su|za(s)
    fontversion: 70123(i)(s)
    capability: "otlayout:DFLT otlayout:cyrl otlayout:grek otlayout:latn"(s)
    fontformat: "TrueType"(s)
    decorative: False(s)
    hash: "sha256:2829b7333ab4697f7b2d68855fca83f1be92121db16dd0bfcf3ae2b416839b05"(s)
    postscriptname: "LiberationSerif"(s)

После чего вы можете получить из его вывода fullnameили postscriptname.

0
03.08.2020, 01:48
1 ответ

Спецификация POSIX для crontab, сформулированная на языке стандарта с целью минимизации двусмысленности, имеет, вероятно, самое ясное объяснение (добавлено выделение, абзац разделен для ясности):

The specification of days can be made by two fields (day of the month and day of the week).

If month, day of month, and day of week are all <asterisk> characters, every day shall be matched.

If either the month or day of month is specified as an element or list, but the day of week is an <asterisk>, the month and day of month fields shall specify the days that match.

If both month and day of month are specified as an <asterisk>, but day of week is an element or list, then only the specified days of the week match.

Finally, if either the month or day of month is specified as an element or list, and the day of week is also specified as an element or list, then any day matching either the month and day of month, or the day of week, shall be matched.

Это подтверждает, что:

  1. Задача в вашем примере выполняется, если текущий день либо либо среда, либо второй день месяца.

  2. Это задокументированное стандартное поведение.

3
18.03.2021, 23:15

Теги

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