Facing Issue after configuring logrotate


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Facing Issue after configuring logrotate
# 1  
Old 10-15-2011
Facing Issue after configuring logrotate

Hi,

I have a logrotate configuration which rotates a log every night 1 min before midnight, but somehow its not working and unfortunately not showing any error message as well. Sharing the code for the cron job as well as the conf file, I am using, if some one coule help me..whats wrong with this..would be helpful.
--------------------------------------------
Code:
#!/bin/sh


if [ ! -d /var/tmp/logrotate ]; then
   mkdir /var/tmp/logrotate
fi

TMPDIR=/var/tmp/logrotate
export TMPDIR

/usr/sbin/logrotate /somepath/config/abc/somelog.conf
EXITVALUE=$?

echo "+++++++++++++++++" > /tmp/somerotate.log
if [ $EXITVALUE != 0 ]; then
    /usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"
    echo "1" > /tmp/somerotate.log
fi
echo "0" > /tmp/somerotate.log
rm -Rf /var/tmp/logrotate

exit

------------------------------------------

Code:
/abc/def/ghi/somelog.log {
daily
missingok
rotate 365
copytruncate
notifempty
create
postrotate
compress
endscript
}

I can see the status of this in logrotate.status file...but can't figure out the problem.

Neeryan

Last edited by Neeryan; 10-15-2011 at 04:05 PM..
# 2  
Old 10-15-2011
Define "not working". Are you getting any messages in the syslog, or the log file you're creating? Did you try running the script outside of cron?

There's a few things I notice. First, the compress directive doesn't belong in the postrotate section, unless you want to call the utility of the same name. Second, the logs are saved in the same directory as they were before, not somewhere else.
# 3  
Old 10-16-2011
here not working means..the rotation is not happening..I have tried it outside cron as well..but no luck, no rotation is happening. I have tried by removing the compress from post rotate but still no luck. Also, I am rotating the logs at the same location no different location.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. SuSE

Facing issue configuring network

Please let me know how to configure network in suse Linux, I have configured the network using ifup and network manager, it is not giving any error but not working, using suse Linux 11.0 sp3 I have checked network connectivity is working. (0 Replies)
Discussion started by: manoj.solaris
0 Replies

2. Shell Programming and Scripting

UNIX joins : facing issue while joining three files

Hello , I have three files : sampleoutput1.txt has columns (in the following order) : hostname ; available patches , available packages sampleoutput2.txt has columns (in the following order) : hostname ; patchwave ; BSID ; Application sampleoutput3.txt has columns (in the following... (10 Replies)
Discussion started by: rahul2662
10 Replies

3. Solaris

Facing problem in configuring syslog server in Solaris

I am trying to configure central syslog server On hostA, in /etc/syslog.conf file,I am adding below line*.err;kern.debug;daemon.notice;mail.crit @hostB then I am restarting syslog servicesvcadm restart /system/system-log In hostA, I have already added hostB entry in /etc/hosts... (5 Replies)
Discussion started by: amity
5 Replies

4. Solaris

Facing issue while installing weblogic on Solaris 11

Hi, i am facing issue while installing weblogic on solaris..its giving me invalid argument error. solaris is intstalled on my VM. uname -a SunOS Vishal 5.10 Generic_137138-09 i86pc i386 i86pc screenshot attached. (5 Replies)
Discussion started by: Vishal Baghla
5 Replies

5. Red Hat

Logrotate issue in RHEL

Hi, I have a requirement to compress logs that generate daily. Below is the logrotate configuration for this But for some kind of reason the logs are not getting compressed daily. When tried to execute the logrotate manually with -d it says "log does not need rotating." The path... (0 Replies)
Discussion started by: EmbedUX
0 Replies

6. Infrastructure Monitoring

Facing Issue in Nagios 3.3

Hi, I have installed Nagios on Redhat Linux, I have installed Nagios+Plugins+NRPE on Server A (Host Server) and Nagios Plugins + nrpe on remote linux server (red hat linux) run the command on remote linux host, it returns nrpe version usr/local/nagios/libexec/check_nrpe -H localhost ... (1 Reply)
Discussion started by: manoj.solaris
1 Replies

7. UNIX for Advanced & Expert Users

Logrotate issue on SUSE 10

I'm stumped. Can anyone spot the issue? I'm running logrotate with a conf file that points to a single file. The output from logrotate indicates it copied the file and is going to truncate the file, but then the original file exists unchanged, and the copied file doesn't exist. My shell... (1 Reply)
Discussion started by: jdveencamp
1 Replies

8. Infrastructure Monitoring

Facing problem while configuring snmp

HI, I am facing these two errors while configuring snmp can any body guide me. vi /var/log/snmpd.log Error opening specified endpoint "udp:161" Server Exiting with code 1 i also tried bash-3.00# netstat -a | grep snm *.snmpd Idle bash-3.00# lsof -i :161 bash: lsof: command not... (2 Replies)
Discussion started by: nir1785
2 Replies

9. Shell Programming and Scripting

Facing issue while using xsltproc tp parse XML in bash

I have written a bash script which opens a folder, reads all the *.xml files in it, and pulls the required data that i need from XML tags. I am using xsltproc (my xsl name) (my xml folder location/*.xml) and running this in a for each loop The problem is that some XML files are having special... (3 Replies)
Discussion started by: shivashankar.g
3 Replies

10. HP-UX

Facing an issue related to cronjob

Dear All, I am facing an issue related to cronjob and explained below is the case study: 1. I have a java class named "DmCheckRenditionQueue.java" and placed under "/cpc/documentum/product/5.2.5/tomcat/webapps/rendition" 2. When I am using the command "/usr/openv/java/jre/bin/java -cp... (1 Reply)
Discussion started by: parindam
1 Replies
Login or Register to Ask a Question