From 8f8cf2ecfc5dc6ea28bdf001657931c52b23b969 Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Fri, 6 Nov 2015 13:31:51 +0800 Subject: [PATCH 1/3] Fix logrotate for Ubuntu. For rsyslogd in Ubuntu, there is a different pid file. --- xCAT/etc/logrotate.d/xcat | 1 + 1 file changed, 1 insertion(+) diff --git a/xCAT/etc/logrotate.d/xcat b/xCAT/etc/logrotate.d/xcat index da6a2746c..65d1df063 100644 --- a/xCAT/etc/logrotate.d/xcat +++ b/xCAT/etc/logrotate.d/xcat @@ -2,6 +2,7 @@ missingok sharedscripts postrotate + /bin/kill -HUP `cat /var/run/rsyslogd.pid 2> /dev/null` 2> /dev/null || true /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true /bin/kill -HUP `cat /var/run/xcat/cmdlogservice.pid 2> /dev/null` 2> /dev/null || true endscript From b08166fec2870f0cfc2859a121afc4c716baa2ee Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Fri, 6 Nov 2015 13:45:25 +0800 Subject: [PATCH 2/3] Check if the pid files exist --- xCAT/etc/logrotate.d/xcat | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xCAT/etc/logrotate.d/xcat b/xCAT/etc/logrotate.d/xcat index 65d1df063..f820f55e7 100644 --- a/xCAT/etc/logrotate.d/xcat +++ b/xCAT/etc/logrotate.d/xcat @@ -2,8 +2,8 @@ missingok sharedscripts postrotate - /bin/kill -HUP `cat /var/run/rsyslogd.pid 2> /dev/null` 2> /dev/null || true - /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true - /bin/kill -HUP `cat /var/run/xcat/cmdlogservice.pid 2> /dev/null` 2> /dev/null || true + test -f /var/run/rsyslogd.pid && kill -HUP `cat /var/run/rsyslogd.pid 2> /dev/null` 2> /dev/null || true + test -f /var/run/syslogd.pid && kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true + test -f /var/run/xcat/cmdlogservice.pid && kill -HUP `cat /var/run/xcat/cmdlogservice.pid 2> /dev/null` 2> /dev/null || true endscript } From 1219fdd23fb8602bb1029b96bb69cf4d746f0029 Mon Sep 17 00:00:00 2001 From: GONG Jie Date: Fri, 6 Nov 2015 14:25:25 +0800 Subject: [PATCH 3/3] Avoid the original rsyslog.conf changing. Since xCAT has new rsyslog strategy. --- xCAT/postscripts/syslog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xCAT/postscripts/syslog b/xCAT/postscripts/syslog index 6a807aad4..1b0aa07b4 100755 --- a/xCAT/postscripts/syslog +++ b/xCAT/postscripts/syslog @@ -102,7 +102,7 @@ config_Rsyslog_C3() if [ $isLocal -eq 1 ]; then #enable the MN to log all the logs from CN and MN itself sed -i 's/\(^[^\#].*\/var\/log\/messages\)/\#\1/g' $2 - echo "*.debug /var/log/messages" >> $2 + echo "#*.debug /var/log/messages" >> $2 touch /var/log/messages if ( pmatch $OSVER "ubuntu*" ) || ( is_lsb_ubuntu ) || ( pmatch $OSVER "debian*" ); then chown syslog:adm /var/log/messages @@ -174,7 +174,7 @@ config_rsyslog_V8() sed -i '/^[^#].*\/var\/log\/messages/s/^/#/' $conf_file echo "# xCAT settings" >> $conf_file - echo "*.debug /var/log/messages" >> $conf_file + echo "#*.debug /var/log/messages" >> $conf_file # Need to uncomment the lines $ModLoad imudp.so and $UDPServerRun 514, # to make the MN be able to receive syslog from remote hosts if [ -f "$remoteconf" ]; then