LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-18-2008, 03:02 AM   #1
john lee
Member
 
Registered: Jun 2001
Location: Sydney, Australia
Posts: 42

Rep: Reputation: 15
logrotate of Asterisk log at midnight


I am trying to do log rotation on my Asterisk log.
I put the following script in /etc/logrotate.d:
/var/log/asterisk/messages /var/log/asterisk/*log
{
daily
missingok
rotate 90
create 0640 asterisk asterisk
sharedscripts
postrotate
/usr/sbin/asterisk -rx "logger reload" > /dev/null 2> /dev/null
endscript
}

/var/log/asterisk/cdr-csv/Master.csv
{
daily
missingok
rotate 365
create 0640 asterisk asterisk

This script works fine.
***However, I want to run this job at midnight rather than 4am which is when logrotate will run.***

I then modified crontab as follows so that the script will run at midnight.

01 * * * * root run-parts /etc/cron.hourly
00 0 * * * root logrotate /etc/logrotate.d/asterisk <===
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly

*** My question is if I do this, will the script be run 2 times - one at midnight and another time at 4am?
I just want to run once at midnight.

Any thoughts?
 
Old 06-18-2008, 11:22 AM   #2
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 234Reputation: 234Reputation: 234
Only if the asterisk logrotate script resides in the cron.daily or other cron.* directories.
 
Old 06-27-2008, 03:38 AM   #3
john lee
Member
 
Registered: Jun 2001
Location: Sydney, Australia
Posts: 42

Original Poster
Rep: Reputation: 15
Thanks for the response.

I ended up moving the script outside of directory logrotate.d because cron will always run whatever is put in this directory.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
logrotate and /var/log/btmp msteiner Linux - General 1 06-14-2007 09:31 PM
Log Rotation using Logrotate keysorsoze Linux - General 4 04-13-2007 03:51 PM
how to logrotate auth.log files? clintcan Linux - Security 1 12-10-2005 05:55 PM
finding considered log name during logrotate Matt Collier Linux - Software 1 10-03-2005 08:51 AM
How to add my log files in logrotate Groucho Slackware 2 10-03-2003 09:16 AM


All times are GMT -5. The time now is 05:57 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration