postrotate: command not found

If, while log rotating with the lovely logrotate, you get ‘sh: line 2: postrotate: command not found’ then you’re probably missing an endscript. This took me a while to notice. I found a number of people with the same problem, such as this chap, and if you look at his script he’s done exactly what I had, and failed to notice that endscript delimits (quite sensibly) the end of each post/pre block, rather than being the end of the script as a whole (which is delimited with {}).

/var/log/somecustom3/somecustom3A.log /var/log/somecustom3/somecustom3.log {
daily
rotate 14
compress
create 644 apache apache
sharedscripts
prerotate
  /usr/bin/svc -d /service/somecustom3
postrotate
  /usr/bin/svc -u /service/somecustom3
endscript
}


/var/log/somecustom3/somecustom3A.log /var/log/somecustom3/somecustom3.log {
daily
rotate 14
compress
create 644 apache apache
sharedscripts
prerotate
  /usr/bin/svc -d /service/somecustom3
endscript
postrotate
  /usr/bin/svc -u /service/somecustom3
endscript
}

One Comment

  1. shogz says:

    I’d wondered what was causing that.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.