Operating System - HP-UX
1753971 Members
7861 Online
108811 Solutions
New Discussion юеВ

Re: Logrotate Problem in cron daemon

 
Muhib Tanim
New Member

Logrotate Problem in cron daemon

Hi

/opt/logrotate/bin/logrotate logrotate.conf executes successfully and fulfill my target, which compressed the old logs.
but when I try to execute same command through cronjob it executes but not compressed only take the backup of old logs.
Then I execute a script through cron, where command and profile execution done.

Any one faced same type of problem before.
6 REPLIES 6
Pete Randall
Outstanding Contributor

Re: Logrotate Problem in cron daemon

Take a look at logrotate to see if the portion that is supposed to compress the old logs identifies the full path name of whatever command it is using.


Pete

Pete
OldSchool
Honored Contributor

Re: Logrotate Problem in cron daemon

most likely, this is related to a pathing problem when running from cron.

for example, when run from the command-line as noted:

/opt/logrotate/bin/logrotate logrotate.conf

what is your current directory, and is logrotate.conf in it?

My first step would be to put the full path to logrotate.conf in the cron job and see what happens.
Jeff_Traigle
Honored Contributor

Re: Logrotate Problem in cron daemon

We use a wrapper script that we run from cron that sets the PATH so gzip can be found by logrotate.

#!/usr/bin/sh

PATH=/bin:/usr/bin:/usr/contrib/bin

/opt/logrotate/bin/logrotate /etc/logrotate.conf
--
Jeff Traigle
Arturo Galbiati
Esteemed Contributor

Re: Logrotate Problem in cron daemon

Hi,
create a new script to add in crontab under teh user you run successfully online and add

. .profile
opt/logrotate/bin/logrotate logrotate.conf

to be sure that all neeede paths will be loaded.

HTH,
Art
Muhib Tanim
New Member

Re: Logrotate Problem in cron daemon

Thanks Jeff Traigle

PATH=/bin:/usr/bin:/usr/contrib/bin

solved the problem
Muhib Tanim
New Member

Re: Logrotate Problem in cron daemon

solved