add the more addional log information to postscripts

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@5680 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
wuzhy 2010-04-06 08:17:04 +00:00
parent 68904a9cea
commit 4e780ead9b
27 changed files with 91 additions and 26 deletions

View File

@ -1,6 +1,7 @@
#!/bin/sh
cd `dirname $0`
if [ ! -d repos/$OSVER/$ARCH ]; then
logger -t xcat "repos/$OSVER/$ARCH is not a directory"
exit;
fi
for i in repos/$OSVER/$ARCH/*

View File

@ -47,11 +47,17 @@ $home = $root[5];
$rc = &runcmd("chown root $home");
if ($rc != 0)
{
my $msg = "It fails to chown root $home";
if (defined($logenable)) {
`logger -t xcat $msg`;
}
exit 1;
}
$rc = &runcmd("chgrp system $home");
if ($rc != 0)
{
my $msg = "It fails to chgrp system $home";
`logger -t xcat $msg`;
exit 1;
}

View File

@ -3,7 +3,7 @@ BEGIN {
listener = "/inet/tcp/300/0/0"
quit = "no"
print $0 | "logger -t xcat"
while (match(quit,"no")) {
while ((listener |& getline) > 0) {
if (match($0,"CREDOKBYYOU?")) {

View File

@ -2,8 +2,10 @@
#get IP address of MS
OS=`uname`
echo "the OS is $OS"
logger -t xCAT "the OS is $OS"
ms_ip=$MONMASTER
echo "hi is $ms_ip"
echo "MS IP is $ms_ip"
logger -t xCAT "the MS is $ms_ip"
result=`ping -c1 $MONMASTER 2>&1`
if [ $? -eq 0 ]; then
index1=`expr index "$result" "\("`
@ -15,11 +17,12 @@ result=`ping -c1 $MONMASTER 2>&1`
ms_ip=`expr substr "$result" $pos $length`
echo final is $ms_ip
else
logger xCAT "Gangliamon setup"
logger -t xCAT "Gangliamon setup"
fi
CLUSTER=\"$MONSERVER\"
echo "cluster is $CLUSTER"
logger -t xCAT "cluster is $CLUSTER"
MASTER=$ms_ip
#echo "The new IP is: $NEW_IP"
#echo "I will replace now....
@ -28,8 +31,10 @@ gmond_conf_old="/etc/gmond.conf"
if [ $OS == "AIX" ]; then
echo "into AIX loop"
logger -t xCAT "into AIX loop"
if [ -f $gmond_conf_old ]; then
echo "ganglia version 3.0.7"
logger -t xCAT "ganglia version 3.0.7"
grep "xCAT gmond settings done" $gmond_conf_old
if [ $? -gt 0 ]; then
/bin/cp -f $gmond_conf_old /etc/gmond.conf.orig
@ -48,8 +53,10 @@ gmond_conf_old="/etc/gmond.conf"
if [ $OS == "AIX" ]; then
echo "into AIX new loop"
logger -t xCAT "into AIX new loop"
if [ -f $gmond_conf ]; then
echo "ganglia version v3.10"
logger -t xCAT "ganglia version v3.10"
grep "xCAT gmond settings done" $gmond_conf
if [ $? -gt 0 ]; then
/bin/cp -f $gmond_conf /etc/ganglia/gmond.conf.orig
@ -71,6 +78,7 @@ gmond_conf_old="/etc/gmond.conf"
if [ $OS != "AIX" ]; then
echo "not AIX"
logger -t xCAT "not AIX"
if [ -f $gmond_conf ]; then
grep "xCAT gmond settings done" $gmond_conf
if [ $? -gt 0 ]; then
@ -89,6 +97,7 @@ gmond_conf_old="/etc/gmond.conf"
if [ $OS != "AIX" ]; then
echo "not AIX"
logger -t xCAT "not AIX"
if [ -f $gmond_conf_old ]; then
grep "xCAT gmond settings done" $gmond_conf_old
@ -107,12 +116,14 @@ fi
if [ ! -f $gmond_conf ]; then
# echo "file not found"
logger -t gmonfail "gmond configuration file not found"
logger -t gmonfail "gmond configuration file not found"
logger -t xCAT "gmond configuration file not found"
fi
if [ ! -f $gmond_conf_old ]; then
# echo "file not found"
logger -t gmonfail "gmond configuration file not found"
logger -t xCAT "gmond configuration file not found"
fi
exit 0

View File

@ -3,7 +3,7 @@
#egan@us.ibm.com
#(C)IBM Corp
#
echo "$0: the OS version is $OSVER" | logger -t xcat
case $OSVER in
sles*|suse*|ul*)
perl -pi -e 's/^KERNEL_LOGLEVEL=1/KERNEL_LOGLEVEL=8/' /etc/sysconfig/syslog

View File

@ -16,7 +16,7 @@ BEGIN {
print "</xcatrequest>" |& server
while (server |& getline) {
print $0
print $0 | "logger -t xcat"
if (match($0,"<serverdone>")) {
quit = "yes"
}

View File

@ -15,7 +15,7 @@ BEGIN {
print "</xcatrequest>" |& server
while (server |& getline) {
print $0
print $0 | "logger -t xcat"
if (match($0,"<serverdone>")) {
quit = "yes"
}

View File

@ -18,6 +18,7 @@ ARCH=$(uname -m)
DIRS="$LOCALDIR/goto/lib"
echo "$0: arch is $ARCH" | logger -t xcat
case "$ARCH" in
i686)
DIRS="$DIRS $LOCALDIR/intel/$ARCH/lib"

View File

@ -76,14 +76,17 @@ stop () {
grep -q GenuineIntel /proc/cpuinfo && /sbin/modprobe -r kvm-intel
grep -q AuthenticAMD /proc/cpuinfo && /sbin/modprobe -r kvm-amd
}
logger -t xcat "KVM $1"
case "\$1" in
start)
echo -n $"Starting KVM: "
logger -t xcat "Starting KVM:"
start
echo
;;
stop)
echo -n $"Shutting down KVM: "
logger -t xcat "Shutting down KVM:"
stop
echo
;;
@ -92,7 +95,9 @@ case "\$1" in
;;
*)
echo "Unknown command: \$1" >&2
logger -t xcat "Unknown command: \$1"
echo "Valid commands are: start, stop, status" >&2
logger -t xcat "Valid commands are: start, stop, status"
exit 1
esac
EOF
@ -120,6 +125,7 @@ disconnect_targets()
{
iscsiadm -m node --logout
}
logger -t xcat "iscsi $1"
case "\$1" in
start)
connect_targets
@ -132,7 +138,9 @@ case "\$1" in
;;
*)
echo "Unknown command: \$1" >&2
logger -t xcat "Unknown command: \$1"
echo "Valid commands are: start, stop, status" >&2
logger -t xcat "Valid commands are: start, stop, status"
exit 1
esac
EOF

View File

@ -24,6 +24,7 @@ XCATFS=$MASTER:$XCATROOT
logger -t xcat "Install: setup NFS mounts in fstab"
echo "$0: the OS version is $OSVER" | logger -t xcat
case "$OSVER" in
rhfc[23])
XOPTS=",nfsvers=2"

View File

@ -63,7 +63,9 @@ if [ $mounted -eq 0 ]; then
fi
echo NFSSERVER=$NFSSERVER
logger -t xcat "NFSSERVER=$NFSSERVER"
echo OTHERPKGDIR=$OTHERPKGDIR
logger -t xcat "OTHERPKGDIR=$OTHERPKGDIR"
#check if the node has yum or zypper installed, it will try yum first, then zypper and last rpm
hasyum=0
@ -220,15 +222,17 @@ if [ "$repo_pkgs_preremove" != "" ]; then
if [ $hasyum -eq 1 ]; then
echo "yum -y remove $repo_pkgs_preremove"
result=`yum -y remove $repo_pkgs_preremove 2>&1`
logger -t xcat "$result"
if [ $? -ne 0 ]; then
logger "otherpkgs: $result"
logger -t xcat "otherpkgs: $result"
fi
echo "$result"
elif [ $haszypper -eq 1 ]; then
echo "zypper remove -y $repo_pkgs_preremove"
result=`zypper remove -y $repo_pkgs_preremove 2>&1`
logger -t xcat "$result"
if [ $? -ne 0 ]; then
logger "otherpkgs: $result"
logger -t xcat "otherpkgs: $result"
fi
echo "$result"
fi
@ -237,8 +241,9 @@ fi
if [ "$plain_pkgs_preremove" != "" ]; then
echo "rpm -ev $plain_pkgs_preremove"
result=`rpm -ev $plain_pkgs_preremove 2>&1`
logger -t xcat "$result"
if [ $? -ne 0 ]; then
logger "otherpkgs $result"
logger -t xcat "otherpkgs $result"
fi
echo "$result"
fi
@ -249,15 +254,17 @@ if [ "$repo_pkgs" != "" ]; then
if [ $hasyum -eq 1 ]; then
echo "yum -y install $repo_pkgs"
result=`yum -y install $repo_pkgs 2>&1`
logger -t xcat "$result"
if [ $? -ne 0 ]; then
logger "otherpkgs: $result"
logger -t xcat "otherpkgs: $result"
fi
echo "$result"
elif [ $haszypper -eq 1 ]; then
echo "zypper install -y $repo_pkgs"
result=`zypper install -y $repo_pkgs 2>&1`
logger -t xcat "$result"
if [ $? -ne 0 ]; then
logger "otherpkgs: $result"
logger -t xcat "otherpkgs: $result"
fi
echo "$result"
#remove the repos
@ -294,8 +301,9 @@ if [ "$plain_pkgs" != "" ]; then
echo "rpm -Uvh --replacepkgs $plain_pkgs"
result=`rpm -Uvh --replacepkgs $plain_pkgs 2>&1`
#result=`rpm -Fvh $plain_pkgs 2>&1`
logger -t xcat "$result"
if [ $? -ne 0 ]; then
logger "otherpkgs $result"
logger -t xcat "otherpkgs $result"
fi
echo "$result"
@ -311,15 +319,17 @@ if [ "$repo_pkgs_postremove" != "" ]; then
if [ $hasyum -eq 1 ]; then
echo "yum -y removel $repo_pkgs_postremove"
result=`yum -y remove $repo_pkgs_postremove 2>&1`
logger -t xcat "$result"
if [ $? -ne 0 ]; then
logger "otherpkgs: $result"
logger -t xcat "otherpkgs: $result"
fi
echo "$result"
elif [ $haszypper -eq 1 ]; then
echo "zypper remove -y $repo_pkgs_postremove"
result=`zypper remove -y $repo_pkgs_postremove 2>&1`
logger -t xcat "$result"
if [ $? -ne 0 ]; then
logger "otherpkgs: $result"
logger -t xcat "otherpkgs: $result"
fi
echo "$result"
fi
@ -328,8 +338,9 @@ fi
if [ "$plain_pkgs_postremove" != "" ]; then
echo "rpm -ev $plain_pkgs_postremove"
result=`rpm -ev $plain_pkgs_postremove 2>&1`
logger -t xcat "$result"
if [ $? -ne 0 ]; then
logger "otherpkgs $result"
logger -t xcat "otherpkgs $result"
fi
echo "$result"
fi

View File

@ -38,6 +38,7 @@ fi
# cp /xcatpost/hostkeys/*_key /etc/ssh/
#fi
if [ ! -x /usr/bin/openssl ]; then
logger -t xcat "Install: /usr/bin/openssl is not executable."
exit 0
fi
allowcred.awk &
@ -140,6 +141,7 @@ if [ -r /root/.ssh/id_rsa ]; then
fi
# start up the sshd for syncfiles postscript to do the sync work
logger -t xCAT "start up sshd"
service sshd start
kill -9 $CREDPID

View File

@ -14,6 +14,7 @@ done
if [ -n "$GRUB" ]
then
logger -t xcat "Install: the GRUB dir is $GRUBDIR"
cd $GRUBDIR
perl -pi -e 's/^gfxmenu/#gfxmenu/' $GRUBFILE
perl -pi -e 's/^color/#color/' $GRUBFILE

View File

@ -123,6 +123,7 @@ else
&runcmd("/opt/xcat/sbin/copycerts");
}
`logger -t xcat rc=$rc`;
exit $rc;
#

View File

@ -12,6 +12,7 @@ BEGIN {
print $0 | "logger -t xcat"
else {
print "Retrying iSCSI paramater config script"
print "Retrying iSCSI paramater config script" | "logger -t xcat"
close(ns)
system("sleep 1")
}

View File

@ -9,7 +9,7 @@
if [ -r /etc/ldap.conf -a -r /etc/resolv.conf ]
then
echo -n " LDAP: "
logger -t xcat " LDAP: "
DC=$(
cat /etc/resolv.conf | \
egrep '(domain|search)' | \

View File

@ -55,6 +55,7 @@ esxcfg-firewall -e ntpClient
esxcfg-firewall -o 123,udp,out,ntpServer
esxcfg-firewall -o 514,udp,out,syslog
esxcfg-firewall -l
logger -t xcat "Install: restart syslog"
service syslog restart
EOF1

View File

@ -28,6 +28,7 @@ if [ "$master" == "$sitemaster" ]; then
master=$i
done
else
logger -t xcat "Install: $NTPSERVERS don't exist"
exit 0
fi

View File

@ -21,6 +21,7 @@ then
logger -t xcat "Install: sync clock"
ntpdate -bs $T 2>&1 | logger -t xcat
logger -t xcat "$0: the OS version is $OSVER"
case "$OSVER" in
rh9|rh[awe]s[34]|rh*5)
hwclock -w 2>&1 | logger -t xcat

View File

@ -14,6 +14,7 @@ fi
#do nothing id there is no sync file template for the node
if [[ $NOSYNCFILES -eq 1 ]]; then
logger -t xCAT "$0: there is no sync file template for the node"
exit 0
fi
@ -22,6 +23,7 @@ if [ "$NODESETSTATE" = "netboot" -o \
"$NODESETSTATE" = "diskless" -o \
"$NODESETSTATE" = "dataless" ]
then
logger -t xCAT "$0: the node set state is $NODESETSTATE"
exit 0
fi
@ -32,6 +34,7 @@ osname=`uname`
# run the xdcp on the MN/SN
xcatpostdir="/xcatpost"
logger -t xCAT "$0: the OS name = $osname"
if [ $osname = "Linux" ]
then
`$xcatpostdir/startsyncfiles.awk`
@ -44,9 +47,9 @@ fi
if [ $returncode -eq 1 ]
then
logger -t xCAT "Perform Syncing File action successfully"
logger -t xCAT "$0: Perform Syncing File action successfully"
else
logger -t xCAT "Perform Syncing File action encountered error"
logger -t xCAT "$0: Perform Syncing File action encountered error"
fi
exit 0

View File

@ -10,6 +10,7 @@ BEGIN {
print $0 | "logger -t xcat"
else {
print "Retrying unlock of tftp directory"
print "$0: Retrying unlock of tftp directory" | "logger -t xcat"
close(ns)
system("sleep 5")
}

View File

@ -14,6 +14,8 @@
# if AIX - make sure we include perl 5.8.2 in INC path.
# Needed to find perl dependencies shipped in deps tarball.
my $osname = $^0;
`logger -t xcat $osname`;
if ($^O =~ /^aix/i) {
use lib "/usr/opt/perl5/lib/5.8.2/aix-thread-multi";
use lib "/usr/opt/perl5/lib/5.8.2";
@ -40,6 +42,7 @@ if (!-d $logdir) {
$::sdate = `/bin/date`;
chomp $::sdate;
my $logfile = $logdir . "/xcat.log";
`logger -t xcat $logfile`;
# this log should not contain much so it might be ok to let it grow?
# at least we'll have the errors preserved
@ -258,12 +261,15 @@ if (-f $scriptname)
run_ps () {
if [[ -f \\\$1 ]]; then
echo \\"Running postscript: \\\$1\\"
print $::LOG_FILE "$::sdate xcataixpost: Running postscript: $1\n";
OUTPUT=\\\`./\\\$1 2>&1\\\`
if [[ -n \\\$OUTPUT ]]; then
echo \\"\\\$OUTPUT\\"
print $::LOG_FILE "$::sdate xcataixpost: output=$output\n";
fi
else
echo \\"Postscript \\\$1 does NOT exist.\\"
print $::LOG_FILE "$::sdate xcataixpost: $1 does NOT exist.\n";
fi
}
# subroutine end
@ -276,6 +282,7 @@ run_ps () {
$ENV{PATH}="/xcatpost:$ENV{PATH}";
&runcmd("cd /xcatpost;$scriptname");
print $::outref;
print $::LOG_FILE "$::sdate xcataixpost: outref = $::outref\n";
} else {
print "$::sdate xcataixpost: Could not find post script for $::shorthost.\n";
print $::LOG_FILE "$::sdate xcataixpost: Could not find post script for $::shorthost.\n";
@ -296,6 +303,7 @@ if (@ARGV<1) {
} else {
#called by updatenode, infrom user it is done
print "returned from postscript";
print $::LOG_FILE "$::sdate xcataixpost: returned from postscript.\n";
}
if (-f $scriptname) {
@ -442,7 +450,7 @@ sub updateflag {
sub runcmd
{
my ($cmd) = @_;
my $rc=0;
my $rc=0;
$cmd .= ' 2>&1' ;
$::outref = [];
$::outref = `$cmd`;
@ -451,8 +459,8 @@ sub runcmd
$rc = $? >> 8;
if ($rc > 0)
{
# print "$::sdate xcataixpost: $::outref\n";
# print $::LOG_FILE "$::sdate xcataixpost: $::outref\n";
print "$::sdate xcataixpost: $::outref\n";
print $::LOG_FILE "$::sdate xcataixpost: $::outref\n";
}
}
return $rc;

View File

@ -75,8 +75,8 @@ if ((@ARGV==0) || ($ARGV[0] != 2)) {
}
if (&runcmd($cpcmd) != 0) {
# print "$::sdate xcataixpost: Could not copy postscripts to /xcatpost.\n";
# print $::LOG_FILE "$::sdate xcataixpost: Could not copy postscripts to /xcatpost.\n";
print "$::sdate xcataixpost: Could not copy postscripts to /xcatpost.\n";
print $::LOG_FILE "$::sdate xcataixpost: Could not copy postscripts to /xcatpost.\n";
}
# make sure all are executable
@ -124,8 +124,8 @@ sub runcmd
$rc = $? >> 8;
if ($rc > 0)
{
# print "$::sdate xcataixpost: $::outref\n";
# print $::LOG_FILE "$::sdate xcataixpost: $::outref\n";
print "$::sdate xcataixpost: $::outref\n";
print $::LOG_FILE "$::sdate xcataixpost: $::outref\n";
}
}
return $rc;

View File

@ -5,6 +5,7 @@
#
if [ ! -x /usr/bin/openssl ]; then #Unless we have openssl stup
logger -t xcat "$0: /usr/bin/openssl is not executable"
exit 0
fi
USEOPENSSLFORXCAT=1 #Declare 2.3 style SSL

View File

@ -8,6 +8,7 @@
if [ ! `uname` == Linux ]; then
MYDIR=`dirname $0`
#exec $MYDIR/xcatdsklspost.aix
logger -t xcat "$0: the OS name is not Linux"
exit
fi
let SLI=$RANDOM%10

View File

@ -19,6 +19,7 @@ if [ -x /etc/rc.d/init.d/functions ]; then
. /etc/rc.d/init.d/functions
fi
logger -t xcat "$0: action is $1"
case $1 in
restart)
$0 stop
@ -26,9 +27,11 @@ restart)
;;
status)
echo -n "xcatpostinit runs only at boot, runs additional post scripts"
logger -t xcat "xcatpostinit runs only at boot, runs additional post scripts"
;;
stop)
echo -n "nothing to stop "
logger -t xcat "nothing to stop"
;;
start)
# run /opt/xcat/xcatdsklspost

View File

@ -5,6 +5,7 @@
#
if [ ! -x /usr/bin/openssl ]; then
logger -t xcat "$0: /usr/bin/openssl is not executable"
exit 0
fi
USEOPENSSLFORXCAT=1