1753758 Members
4975 Online
108799 Solutions
New Discussion юеВ

Re: Logrotate

 
SOLVED
Go to solution
Geetha_1
Regular Advisor

Logrotate

Can anybody list the steps involved in configuring logrotate for hp-ux 11.0? I get the following error

error reading top line of /opt/logrotate/adm/logrotate.status

( I didn't have a logrotate.status file, just touched one - not sure what the syntax of this state file is). My /etc/logrotate.conf file has the foll lines

#Sample Log rotate Configuration file
/var/log/syslog/syslog.log {
rotate 5
weekly
postrotate
/sbin/killall -HUP syslogd
endscript
}

Thanks!
Geetha.
5 REPLIES 5
Jeff_Traigle
Honored Contributor

Re: Logrotate

As long as /opt/logrotate/adm exists, logrotate should create the status file on it's own. (The depot on the Porting and Archive site doesn't create this directory.) On my systems, the permissions are:

drwxr-x--x 2 root sys 96 Feb 14 2006 adm

Status file was created with these permissions:

-rw-rw-rw- 1 root sys 2088 Dec 17 23:59 logrotate.status

First line of the status file is:

logrotate state -- version 1
--
Jeff Traigle
Geetha_1
Regular Advisor

Re: Logrotate

Thanks, Jeff! I got rid of the error - but I tested it out and it doesn't seem to rotate the syslog.

My /etc/logrotate.conf

#Sample Log rotate Configuration file
/var/adm/syslog/syslog.log {
rotate 5
daily
postrotate
/sbin/killall -HUP syslogd
endscript
}

what is wrong?

crontab entry

# Logrotate
45 14 * * * /opt/logrotate/bin/logrotate /etc/logrotate.conf >/tmp/logrotate.cron 2>&1
Jeff_Traigle
Honored Contributor
Solution

Re: Logrotate

It's a bit goofy. The first time it runs, it doesn't rotate the log. It just updates the status file. The next scheduled run, it will actually perform the rotation. On the newer versions, there's a -f option, I think, that would force a rotation, but that option isn't available on the ancient version on the P&A site.
--
Jeff Traigle
Heironimus
Honored Contributor

Re: Logrotate

Just a side note - that syntax for killall is not appropriate for HP-UX. That's a Linux-specific syntax and using it on HP-UX will do nothing if you're lucky and could have dire consequences if you aren't. What you really want is probably something like:

kill -HUP `cat /var/run/syslog.pid`
Geetha_1
Regular Advisor

Re: Logrotate

Thanks! For the tip and the correction on the killall syntax.