From e4be0252293f5f66a00a2c00d76272ad0f8b8320 Mon Sep 17 00:00:00 2001 From: lissav Date: Fri, 29 Feb 2008 16:47:43 +0000 Subject: [PATCH] setup SYSLOG on SN git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@635 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server-2.0/lib/xcat/plugins/SYSLOGsn.pm | 86 ++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 xCAT-server-2.0/lib/xcat/plugins/SYSLOGsn.pm diff --git a/xCAT-server-2.0/lib/xcat/plugins/SYSLOGsn.pm b/xCAT-server-2.0/lib/xcat/plugins/SYSLOGsn.pm new file mode 100644 index 000000000..f74afaf35 --- /dev/null +++ b/xCAT-server-2.0/lib/xcat/plugins/SYSLOGsn.pm @@ -0,0 +1,86 @@ +#!/usr/bin/env perl +# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html +#------------------------------------------------------- +package xCAT_plugin::SYSLOGsn; +use xCAT::Table; + +use xCAT::Utils; + +use xCAT::MsgUtils; +use Getopt::Long; + +#------------------------------------------------------- + +=head1 + xCAT plugin package to setup SYSLOG + + +#------------------------------------------------------- + +=head3 handled_commands + +Check to see if on a Service Node +Call setup_SYSLOG + +=cut + +#------------------------------------------------------- + +sub handled_commands + +{ + my $rc = 0; + if (xCAT::Utils->isServiceNode()) + { + my $service = "syslog"; + + # service needed on this Service Node + $rc = &setup_SYSLOG(); # setup SYSLOG + if ($rc == 0) + { + xCAT::Utils->update_xCATSN($service); + } + } + return $rc; +} + +#------------------------------------------------------- + +=head3 process_request + + Process the command + +=cut + +#------------------------------------------------------- +sub process_request +{ + return; +} + +#----------------------------------------------------------------------------- + +=head3 setup_SYSLOG + + Sets up SYSLOG + +=cut + +#----------------------------------------------------------------------------- +sub setup_SYSLOG +{ + my $rc = 0; + if (-e "/etc/syslog.conf") + { + my $cmd = "grep *.debug /etc/syslog.conf"; + xCAT::Utils->runcmd($cmd, -1); + if ($::RUNCMD_RC != 0) + { # need to add + ` echo "*.debug /var/log/messages" >> /etc/syslog.conf`; + `echo "*.crit /var/log/messages" >> /etc/syslog.conf`; + } + } + + return $rc; +} +1;