Uploaded image for project: 'MariaDB MaxScale'
  1. MariaDB MaxScale
  2. MXS-2907

Logrotate warnings when PID file does not exist

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Fixed
    • 2.4.7
    • 2.4.8
    • Packaging
    • None

    Description

      The logrotate script provided by MaxScale performs log rotation by sending the SIGUSR1 signal to the maxscale process as a postrotate action with

      kill -USR1 `cat /var/run/maxscale/maxscale.pid`

      When maxscale is not running for whatever reason, and so no PID file is present, this leads to annoying cron messages like

      cat: /var/run/maxscale/maxscale.pid: No such file or directory
      kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
      error: error running shared postrotate script for '/var/log/maxscale/maxscale.log '
      

      So the existence of the PID file should be checked for before using it, e.g.

      test -r /var/run/maxscale/maxscale.pid && kill -USR1 $(cat /var/run/maxscale/maxscale.pid)
      

      or

      kill -USR1 $(cat /var/run/maxscale/maxscale.pid)  >/dev/null 2> /dev/null || true
      

      PS: also note that the shell backtick syntax for command execution is deprecated, $(...) should be used instead these days ...

      Attachments

        Activity

          People

            markus makela markus makela
            hholzgra Hartmut Holzgraefe
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.