0

There are coutless examples of logrotate configs which contain the following:

postrotate
  systemctl reload nginx 1> /dev/null 2> /dev/null || true
endscript

but what is the motivation behind it? Why is this so overwhelmingly common? Isn't it sane to deliver the output to some files/logs to be able to easily debug if something goes wrong etc?

1
  • 3
    Because people are stupid.
    – Jenny D
    Jun 29, 2019 at 10:45

1 Answer 1

1

In this case errors of the reloading of service can be ignored in the logrotate because them will be processed by the systemd itself, when the reload command will be executed.

Also, the log messages will be stored in the journal anyway so to avoid of duplication the additional output is ignored.

3
  • but will these journal entries include the information that the particular systemctl call was issued by a particular logrotate configuration entry?
    – Bob
    Jul 1, 2019 at 14:15
  • Not. But I think it doesn't matter because this problem caused by something else, not reload command itself. Jul 1, 2019 at 14:58
  • 1
    but what if someone mistakengly writes for example "systeCMtl reload nginx 2> /dev/null" ? will the issue pop up in journal?)
    – Bob
    Jul 1, 2019 at 20:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .