From 7652d4b437e549cc5f66f0b0b57e95db41eb5f49 Mon Sep 17 00:00:00 2001 From: nott Date: Tue, 4 Mar 2008 14:24:06 +0000 Subject: [PATCH] Changed syslog setup code to check for existing backup file. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@658 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server-2.0/sbin/xcatconfig | 47 ++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/xCAT-server-2.0/sbin/xcatconfig b/xCAT-server-2.0/sbin/xcatconfig index 0b59501fd..e61b78996 100644 --- a/xCAT-server-2.0/sbin/xcatconfig +++ b/xCAT-server-2.0/sbin/xcatconfig @@ -368,28 +368,33 @@ if (( ! -r "/etc/xcat/policy.sqlite" ) || $::FORCE) { } } -# setup syslog -my $syslogcmds; -$syslogcmds = "cp /etc/syslog.conf /etc/syslog.conf.ORIG;"; -$syslogcmds .= "echo '*.debug /var/log/localmessages' > /etc/test.tmp;"; -$syslogcmds .= "echo '*.crit /var/log/localmessages' >> /etc/test.tmp;"; -$syslogcmds .= "cat /etc/test.tmp >> /etc/syslog.conf;"; -$syslogcmds .= "rm /etc/test.tmp;"; -$syslogcmds .= "touch /var/log/localmessages;"; -if ($::osname eq 'AIX') { - $syslogcmds .= "stopsrc -s syslogd;"; - $syslogcmds .= "startsrc -s syslogd;"; -} else { - $syslogcmds .= "/etc/rc.d/init.d/syslog stop;"; - $syslogcmds .= "/etc/rc.d/init.d/syslog start;"; -} +# +# set up syslog +# +# if backup file exists assume it's already set up +if (( ! -r "/etc/syslog.conf.ORIG" ) || $::FORCE) { + my $syslogcmds; + $syslogcmds = "cp /etc/syslog.conf /etc/syslog.conf.ORIG;"; + $syslogcmds .= "echo '*.debug /var/log/localmessages' > /etc/test.tmp;"; + $syslogcmds .= "echo '*.crit /var/log/localmessages' >> /etc/test.tmp;"; + $syslogcmds .= "cat /etc/test.tmp >> /etc/syslog.conf;"; + $syslogcmds .= "rm /etc/test.tmp;"; + $syslogcmds .= "touch /var/log/localmessages;"; + if ($::osname eq 'AIX') { + $syslogcmds .= "stopsrc -s syslogd;"; + $syslogcmds .= "startsrc -s syslogd;"; + } else { + $syslogcmds .= "/etc/rc.d/init.d/syslog stop;"; + $syslogcmds .= "/etc/rc.d/init.d/syslog start;"; + } -my $outref = xCAT::Utils->runcmd("$syslogcmds", 0); -if ($::RUNCMD_RC != 0) -{ - xCAT::MsgUtils->message('E', "Could not set up syslog.\n"); -} else { - xCAT::MsgUtils->message('I', "Started syslog daemon.\n"); + my $outref = xCAT::Utils->runcmd("$syslogcmds", 0); + if ($::RUNCMD_RC != 0) + { + xCAT::MsgUtils->message('E', "Could not set up syslog.\n"); + } else { + xCAT::MsgUtils->message('I', "Started syslog daemon.\n"); + } } #