title: How to restart a service in logrotate.conf
body: <p>I am having a script which is generating log in /var/log/venaqua. I want to manage that logs using logrotate. For that I am adding the following code in the /etc/logrotate.d/venaqua file</p>
  
  <pre><code>/var/log/venaqua{
      daily
      prerotate
          /bin/echo "`date` Starting Logrotate" &gt;&gt; /log/var/venaqua
      endscript
      rotate 5
      compress
      minsize 1M
      create 0644 root root
      postrotate
          /bin/systemctl restart venaqua.service
          /bin/echo "`date` Logrotate Completed" &gt;&gt; /log/var/venaqua
      endscript
  }
  </code></pre>
  
  <p>I am testing it by </p>
  
  <pre><code>sudo logrotate -v -f /etc/logrotate.conf
  </code></pre>
  
  <p>and i am getting error as</p>
  
  <pre><code>rotating pattern: /var/log/venaqua forced from command line (5 rotations)
  empty log files are rotated, only log files &gt;= 1048576 bytes are rotated, old logs are removed
  considering log /var/log/venaqua
    Now: 2019-10-25 13:05
    Last rotated at 2019-10-25 12:49
    log needs rotating
  rotating log /var/log/venaqua, log-&gt;rotateCount is 5
  dateext suffix '-20191025'
  glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
  renaming /var/log/venaqua.5.gz to /var/log/venaqua.6.gz (rotatecount 5, logstart 1, i 5),
  renaming /var/log/venaqua.4.gz to /var/log/venaqua.5.gz (rotatecount 5, logstart 1, i 4),
  renaming /var/log/venaqua.3.gz to /var/log/venaqua.4.gz (rotatecount 5, logstart 1, i 3),
  old log /var/log/venaqua.3.gz does not exist
  renaming /var/log/venaqua.2.gz to /var/log/venaqua.3.gz (rotatecount 5, logstart 1, i 2),
  old log /var/log/venaqua.2.gz does not exist
  renaming /var/log/venaqua.1.gz to /var/log/venaqua.2.gz (rotatecount 5, logstart 1, i 1),
  old log /var/log/venaqua.1.gz does not exist
  renaming /var/log/venaqua.0.gz to /var/log/venaqua.1.gz (rotatecount 5, logstart 1, i 0),
  old log /var/log/venaqua.0.gz does not exist
  running prerotate script
  logrotate_script: 2: logrotate_script: cannot create /log/var/venaqua: Directory nonexistent
  error: error running non-shared prerotate script for /var/log/venaqua of '/var/log/venaqua'
  </code></pre>