LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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 11-07-2006, 07:20 PM   #1
hattori.hanzo
Member
 
Registered: Aug 2006
Posts: 168

Rep: Reputation: 15
logrotate, syslog-ng & cron


I have a question about setting up a cron job for logrotate.

In my logrotate.conf I have a postrotate command line to restart syslog-ng.

Code:
postrotate
   /bin/kill -HUP `cat /var/run/syslog-ng.pid`
endscript
Will the -HUP command restart syslog-ng automatically? From the testing after the logrotate, the syslog files remain at zero k and syslog-ng keeps writing to the previous file. ie. messages.1 and not messages.

In my cron, do I need the event to start syslog-ng again? This seems to be the only way I can get syslog-ng to write to the new logs after a logrotate.

Code:
0 0 * * * root /opt/sbin/logrotate /opt/etc/logrotate.conf &>/dev/null
01 0 * * * root /opt/sbin/syslog-ng &>/dev/null
Thanks.
 
Old 11-08-2006, 12:08 PM   #2
jxi
Member
 
Registered: Feb 2003
Location: Richmond VA
Distribution: Slackware 11 -- CentOS 4.4
Posts: 115

Rep: Reputation: 15
`kill' + the -HUP signal should result in the process being restarted. HUP = HangUP i suppose originally used with modems, typically now kill -HUP means "reread the config file and start again".

Break the process into parts and test. E.g.,
does
Quote:
`cat /var/run/syslog-ng.pid`
return the process id you want? (verify with ps aux |grep syslog)

try running the kill -HUP manually with that pid. then ps aux |grep syslog again. Did you get a new process id?

I'm guessing syslog-ng is syslog - newsgroups, right?
 
  


Reply



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
Apache crash on cron->logrotate (weekly) pezzer55 Linux - Software 7 09-30-2008 07:58 PM
Pix logging on syslog... logrotate does not work logicalfuzz Linux - Software 0 03-06-2006 12:04 AM
Cron.daily sends me a logrotate Kill usage message. pollardd Linux - General 1 09-02-2005 12:18 PM
cron.daily & logrotate cccc SUSE / openSUSE 1 07-08-2005 12:06 PM
logrotate && cron pH* Linux - General 9 12-21-2004 10:38 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:23 AM.

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
Open Source Consulting | Domain Registration