LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   logrotate, syslog-ng & cron (https://www.linuxquestions.org/questions/linux-newbie-8/logrotate-syslog-ng-and-cron-499570/)

hattori.hanzo 11-07-2006 07:20 PM

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.

jxi 11-08-2006 12:08 PM

`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?


All times are GMT -5. The time now is 12:58 AM.