mirror of
				https://github.com/xcat2/xcat-core.git
				synced 2025-10-31 03:12:30 +00:00 
			
		
		
		
	add log tag for postscripts (#5805)
This commit is contained in:
		| @@ -1,7 +1,12 @@ | ||||
| #!/bin/bash | ||||
| if [ -n "$LOGLABEL" ]; then | ||||
|     log_label=$LOGLABEL | ||||
| else | ||||
|     log_label="xcat" | ||||
| fi | ||||
| cd `dirname $0` | ||||
| if [ ! -d repos/$OSVER/$ARCH ];  then | ||||
|    logger -t xcat -p local4.err "addsiteyum: repos/$OSVER/$ARCH is not a directory" | ||||
|    logger -t $log_label -p local4.err "addsiteyum: repos/$OSVER/$ARCH is not a directory" | ||||
|    exit -1; | ||||
| fi | ||||
| for i in repos/$OSVER/$ARCH/* | ||||
|   | ||||
| @@ -40,6 +40,12 @@ if [ "$(uname -s|tr 'A-Z' 'a-z')" = "linux" ];then | ||||
|    . $str_dir_name/xcatlib.sh | ||||
| fi | ||||
|  | ||||
| if [ -n "$LOGLABEL" ]; then | ||||
|     log_label=$LOGLABEL | ||||
| else | ||||
|     log_label="xcat" | ||||
| fi | ||||
|  | ||||
| # Subroutine to display message and pass it to syslog | ||||
| # Usage: showmsg "message to putput" ["error"] | ||||
| function showmsg() { | ||||
| @@ -47,9 +53,9 @@ function showmsg() { | ||||
|     error=$2 | ||||
|  | ||||
|     if [ -n "$error" ]; then | ||||
|         $(logger -t xcat -p local4.err $msg) | ||||
|         $(logger -t $log_label -p local4.err $msg) | ||||
|     else | ||||
|         $(logger -t xcat -p local4.info $msg) | ||||
|         $(logger -t $log_label -p local4.info $msg) | ||||
|     fi | ||||
|  | ||||
|     echo $msg | ||||
|   | ||||
| @@ -23,6 +23,12 @@ if [ "$(uname -s|tr 'A-Z' 'a-z')" = "linux" ];then | ||||
|    . $str_dir_name/xcatlib.sh | ||||
| fi | ||||
|  | ||||
| if [ -n "$LOGLABEL" ]; then | ||||
|     log_label=$LOGLABEL | ||||
| else | ||||
|     log_label="xcat" | ||||
| fi | ||||
|  | ||||
| #This is the number of ports for each ib adpator. | ||||
| portnum=1 | ||||
| if [ -n "$NIC_IBAPORTS" ]; then | ||||
| @@ -86,7 +92,7 @@ then | ||||
|         if [ $? -ne 0 ] | ||||
|         then | ||||
|             echo "Not found the driver dameon: rdma or openibd" | ||||
|             logger -p local4.info -t xcat "Not found the driver dameon: rdma or openibd" | ||||
|             logger -p local4.info -t $log_label "Not found the driver dameon: rdma or openibd" | ||||
|             exit | ||||
|         fi | ||||
|     fi | ||||
| @@ -153,7 +159,7 @@ then | ||||
|         OS_name="ubuntu" | ||||
|     else | ||||
|         echo "Unsupported to config IB on this OS!" | ||||
|         logger -p local4.info -t xcat "Unsupported to config IB on this OS!" | ||||
|         logger -p local4.info -t $log_label "Unsupported to config IB on this OS!" | ||||
|         exit | ||||
|     fi | ||||
| 	 | ||||
| @@ -269,7 +275,7 @@ do | ||||
|  | ||||
|    if [ -z "$nicnets" ]; then | ||||
|        echo "No network defined for $nic" | ||||
|        logger -p local4.info -t xcat "No network defined for $nic" | ||||
|        logger -p local4.info -t $log_label "No network defined for $nic" | ||||
|        continue | ||||
|    fi | ||||
|  | ||||
| @@ -342,7 +348,7 @@ do | ||||
|        # Setup goodnics list | ||||
|        if [ "$found" == "0" ]; then | ||||
|            echo "Cannot find network $nicnet for $nic" | ||||
|            logger -p local4.info -t xcat "Cannot find network $nicnet for $nic" | ||||
|            logger -p local4.info -t $log_label "Cannot find network $nicnet for $nic" | ||||
|            continue | ||||
|        else | ||||
|            if [ -z "$goodnics" ]; then | ||||
| @@ -605,7 +611,7 @@ netmask $netmask" >> /etc/network/interfaces | ||||
|  | ||||
|            else | ||||
|                 echo "Unsupported operating system" | ||||
|                 logger -p local4.err -t xcat "Unsupported operating system" | ||||
|                 logger -p local4.err -t $log_label "Unsupported operating system" | ||||
|             fi | ||||
|  | ||||
|        elif [ $PLTFRM == "AIX" ]; then | ||||
| @@ -617,7 +623,7 @@ netmask $netmask" >> /etc/network/interfaces | ||||
|            if [ $? -ne 0 ] | ||||
|            then | ||||
|                echo "$mltnum is not available." | ||||
|                logger -p local4.info -t xcat "$mltnum is not available." | ||||
|                logger -p local4.info -t $log_label "$mltnum is not available." | ||||
|                continue | ||||
|            fi | ||||
|  | ||||
| @@ -680,7 +686,7 @@ then | ||||
|     #/sbin/service $ib_driver restart | ||||
|     if [ "$restart_ib_driver" = "1" ]; then | ||||
|             echo "restart $ib_driver service" | ||||
|             logger -p local4.info -t xcat "restart $ib_driver service" | ||||
|             logger -p local4.info -t $log_label "restart $ib_driver service" | ||||
|             restartservice $ib_driver | ||||
|     fi | ||||
|     for nic in `echo "$goodnics" | tr "," "\n"|sort -u` | ||||
|   | ||||
| @@ -18,6 +18,13 @@ if [ "$(uname -s|tr 'A-Z' 'a-z')" = "linux" ];then | ||||
|    str_dir_name=`dirname $0` | ||||
|    . $str_dir_name/xcatlib.sh | ||||
| fi | ||||
|  | ||||
| if [ -n "$LOGLABEL" ]; then | ||||
|     log_label=$LOGLABEL | ||||
| else | ||||
|     log_label="xcat" | ||||
| fi | ||||
|  | ||||
| error_code=0 | ||||
| #the nics' information contain: | ||||
| #1. ip address | ||||
| @@ -137,7 +144,7 @@ str_inst_nic='' | ||||
| str_ib_nics='' | ||||
| str_os_type=`uname | tr 'A-Z' 'a-z'` | ||||
| if [ "$str_os_type" = "aix" ];then | ||||
|     logger -t xcat -p local4.err "confignics: aix does not support in this build" | ||||
|     logger -t $log_label -p local4.err "confignics: aix does not support in this build" | ||||
|     echo "confignics: aix does not support in this build" | ||||
|     exit 1 | ||||
| fi | ||||
| @@ -166,7 +173,7 @@ then | ||||
|     then | ||||
|         if [ $bool_cfg_inst_nic -eq 1 -o $bool_remove -eq 1 -o ! -z "$num_iba_ports" ] | ||||
|         then | ||||
|             logger -t xcat -p local4.info "confignics --script <myscript> could Not be used with other options" | ||||
|             logger -t $log_label -p local4.info "confignics --script <myscript> could Not be used with other options" | ||||
|             echo "confignics --script <myscript> could Not be used with other options" | ||||
|             exit 1 | ||||
|         fi | ||||
| @@ -175,7 +182,7 @@ then | ||||
|     fi | ||||
| fi | ||||
|  | ||||
| logger -t xcat -p local4.info "confignics is called: config install nic:$bool_cfg_inst_nic, remove: $bool_remove, iba ports: $num_iba_ports" | ||||
| logger -t $log_label -p local4.info "confignics is called: config install nic:$bool_cfg_inst_nic, remove: $bool_remove, iba ports: $num_iba_ports" | ||||
| echo "confignics on $NODE: config install nic:$bool_cfg_inst_nic, remove: $bool_remove, iba ports: $num_iba_ports" | ||||
|  | ||||
| str_temp='' | ||||
| @@ -211,10 +218,10 @@ bool_exit_flag=0 | ||||
| #check the required attributes | ||||
| if [ -z "$NICIPS" ];then | ||||
|    if [ $bool_cfg_inst_nic -eq 1 ];then | ||||
|        logger -t xcat -p local4.info "confignics: configure the install nic. " | ||||
|        logger -t $log_label -p local4.info "confignics: configure the install nic. " | ||||
|        echo "confignics on $NODE:configure the install nic. " | ||||
|    else | ||||
|        logger -t xcat -p local4.info "confignics: nicips attribute is not defined. " | ||||
|        logger -t $log_label -p local4.info "confignics: nicips attribute is not defined. " | ||||
|        echo "confignics on $NODE: nicips attribute is not defined. " | ||||
|        exit 1 | ||||
|    fi | ||||
| @@ -275,7 +282,7 @@ if [ $bool_remove -eq 1 ];then | ||||
|             continue | ||||
|         fi | ||||
|  | ||||
|         logger -t xcat -p local4.info "confignics: remove nic $str_temp_nic" | ||||
|         logger -t $log_label -p local4.info "confignics: remove nic $str_temp_nic" | ||||
|         echo "confignics on $NODE: remove nic $str_temp_nic" | ||||
|         configeth -r $str_temp_nic | ||||
|         if [ $? -ne 0 ]; then | ||||
| @@ -305,13 +312,13 @@ do | ||||
|             # don't run customized script for installnic if not specify the -s | ||||
|             continue | ||||
|         fi | ||||
|         logger -t xcat -p local4.info "confignics: processing custom scripts: ${array_temp[1]} for interface $key" | ||||
|         logger -t $log_label -p local4.info "confignics: processing custom scripts: ${array_temp[1]} for interface $key" | ||||
|         echo "confignics on $NODE: processing custom scripts: ${array_temp[1]} for interface $key" | ||||
|         ${array_temp[1]} | ||||
|     else | ||||
|         if [ "$key" = "$str_inst_nic" ];then | ||||
|             if [ $bool_cfg_inst_nic -eq 1 ];then | ||||
|                 logger -t xcat -p local4.info "confignics: call 'configeth $str_inst_nic'" | ||||
|                 logger -t $log_label -p local4.info "confignics: call 'configeth $str_inst_nic'" | ||||
|                 echo "confignics on $NODE: call 'configeth -s $str_inst_nic" | ||||
|                 configeth -s $str_inst_nic | ||||
|                 if [ $? -ne 0 ]; then | ||||
| @@ -327,7 +334,7 @@ do | ||||
|         elif [ `echo $key | grep -E 'ib[0-9]+'` ];then | ||||
|             str_nic_type="infiniband" | ||||
|         else | ||||
|             logger -t xcat -p local4.info "confignics: unknown nic type for $key: $str_value ." | ||||
|             logger -t $log_label -p local4.info "confignics: unknown nic type for $key: $str_value ." | ||||
|             echo "confignics on $NODE: unknown nic type for $key: $str_value ." | ||||
|             error_code=1 | ||||
|             continue | ||||
| @@ -336,13 +343,13 @@ do | ||||
|         str_network=$(checknetwork ${array_temp[0]}) | ||||
|         echo "$str_network" | grep -i 'error' > /dev/null | ||||
|         if [ $? -eq 0 ];then | ||||
|             logger -t xcat -p local4.info "$str_network" | ||||
|             logger -t $log_label -p local4.info "$str_network" | ||||
|             echo "confignics on $NODE: $str_network" | ||||
|             continue | ||||
|         fi | ||||
|  | ||||
|         if [ "$str_nic_type" = "ethernet" ];then | ||||
|              logger -t xcat -p local4.info "confignics: call 'configeth $key ${array_temp[0]} $str_network'" | ||||
|              logger -t $log_label -p local4.info "confignics: call 'configeth $key ${array_temp[0]} $str_network'" | ||||
|              echo "confignics on $NODE: call 'configeth $key ${array_temp[0]} $str_network'" | ||||
|              configeth $key ${array_temp[0]} $str_network | ||||
|              if [ $? -ne 0 ]; then | ||||
| @@ -355,19 +362,19 @@ do | ||||
|                 str_ib_nics=$key | ||||
|             fi | ||||
|         else | ||||
|             logger -t xcat -p local4.info "confignics: unknown type $str_nic_type for NIC: $key" | ||||
|             logger -t $log_label -p local4.info "confignics: unknown type $str_nic_type for NIC: $key" | ||||
|             echo "confignics on $NODE: unknown type $str_nic_type for NIC: $key" | ||||
|             error_code=1 | ||||
|         fi | ||||
|     fi | ||||
| done | ||||
| if [ -n "$str_ib_nics" ];then | ||||
|     logger -t xcat -p local4.info "confignics: executed script: configib for nics: $str_ib_nics, ports: $num_iba_ports" | ||||
|     logger -t $log_label -p local4.info "confignics: executed script: configib for nics: $str_ib_nics, ports: $num_iba_ports" | ||||
|     echo "confignics on $NODE: executed script: configib for nics: $str_ib_nics, ports: $num_iba_ports" | ||||
|     NIC_IBNICS=$str_ib_nics NIC_IBAPORTS=$num_iba_ports configib | ||||
| else | ||||
|     if [ $bool_remove -eq 1 ];then | ||||
|         logger -t xcat -p local4.info "confignics: executed script: 'configib -u' to remove all ib nics and configuration files" | ||||
|         logger -t $log_label -p local4.info "confignics: executed script: 'configib -u' to remove all ib nics and configuration files" | ||||
|         echo "confignics on $NODE: executed script: 'configib -r' to remove all ib nics and configuration files" | ||||
|         configib | ||||
|         if [ $? -ne 0 ]; then | ||||
|   | ||||
| @@ -5,6 +5,12 @@ if [ "$(uname -s|tr 'A-Z' 'a-z')" = "linux" ];then | ||||
|    . $str_dir_name/xcatlib.sh | ||||
| fi | ||||
|  | ||||
| if [ -n "$LOGLABEL" ]; then | ||||
|     log_label=$LOGLABEL | ||||
| else | ||||
|     log_label="xcat" | ||||
| fi | ||||
|  | ||||
| #--------------------------------------------------------------------------- | ||||
| #=head1  enablecapi | ||||
| #=head2  enable CAPI and tunnel Atomics for compute nodes | ||||
| @@ -16,7 +22,7 @@ fi | ||||
|  | ||||
| function logerr { | ||||
|     echo "$@" | ||||
|     logger -t xcat -p local4.err $@ | ||||
|     logger -t $log_label -p local4.err $@ | ||||
| } | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -69,6 +69,11 @@ cat <<EOF > /etc/init.d/kvm | ||||
| # kvm init script - stripped off bridge code, but still 'Takes care | ||||
| # | ||||
| # description: The KVM is a kernel level Virtual Machine Monitor. | ||||
| if [ -n "\$LOGLABEL" ]; then | ||||
|     log_label=\$LOGLABEL | ||||
| else | ||||
|     log_label="xcat" | ||||
| fi | ||||
| start () { | ||||
|   grep -q GenuineIntel /proc/cpuinfo && /sbin/modprobe kvm-intel | ||||
|   grep -q AuthenticAMD /proc/cpuinfo && /sbin/modprobe kvm-amd | ||||
| @@ -77,17 +82,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 -p local4.info "KVM $1" | ||||
| logger -t \$log_label -p local4.info "KVM $1" | ||||
| case "\$1" in | ||||
|   start) | ||||
|     echo -n $"Starting KVM: " | ||||
|     logger -t xcat  -p local4.info "Starting KVM:" | ||||
|     logger -t \$log_label  -p local4.info "Starting KVM:" | ||||
|     start | ||||
|     echo | ||||
|     ;; | ||||
|   stop) | ||||
|     echo -n $"Shutting down KVM: " | ||||
|     logger -t xcat  -p local4.info "Shutting down KVM:" | ||||
|     logger -t \$log_label  -p local4.info "Shutting down KVM:" | ||||
|     stop | ||||
|     echo | ||||
|     ;; | ||||
| @@ -96,9 +101,9 @@ case "\$1" in | ||||
|     ;; | ||||
|   *) | ||||
|     echo "Unknown command: \$1" >&2 | ||||
|     logger -t xcat  -p local4.info "Unknown command: \$1" | ||||
|     logger -t \$log_label  -p local4.info "Unknown command: \$1" | ||||
|     echo "Valid commands are: start, stop, status" >&2 | ||||
|     logger -t xcat  -p local4.info "Valid commands are: start, stop, status" | ||||
|     logger -t \$log_label  -p local4.info "Valid commands are: start, stop, status" | ||||
|     exit 1 | ||||
| esac | ||||
| EOF | ||||
| @@ -117,6 +122,11 @@ cat <<EOF > /etc/init.d/iscsiconnect | ||||
| # | ||||
| # chkconfig: 345 10 75 | ||||
| # description: iscsi script to discover and connect to targets on boot | ||||
| if [ -n "\$log_label" ]; then | ||||
|     log_label=\$log_label | ||||
| else | ||||
|     log_label="xcat" | ||||
| fi | ||||
| connect_targets() | ||||
| { | ||||
|   iscsiadm -m discovery -t st -p $ISCSITARGET | ||||
| @@ -126,7 +136,7 @@ disconnect_targets() | ||||
| { | ||||
|   iscsiadm -m node --logout | ||||
| } | ||||
| logger -t xcat  -p local4.info "iscsi $1" | ||||
| logger -t \$log_label  -p local4.info "iscsi $1" | ||||
| case "\$1" in | ||||
|     start) | ||||
|       connect_targets | ||||
| @@ -139,9 +149,9 @@ case "\$1" in | ||||
|       ;; | ||||
|     *) | ||||
|       echo "Unknown command: \$1" >&2 | ||||
|       logger -t xcat  -p local4.info  "Unknown command: \$1" | ||||
|       logger -t \$log_label  -p local4.info  "Unknown command: \$1" | ||||
|       echo "Valid commands are: start, stop, status" >&2 | ||||
|       logger -t xcat  -p local4.info "Valid commands are: start, stop, status" | ||||
|       logger -t \$log_label  -p local4.info "Valid commands are: start, stop, status" | ||||
|       exit 1 | ||||
| esac | ||||
| EOF | ||||
|   | ||||
| @@ -20,9 +20,15 @@ domain=$DOMAIN     # this is the domain name used in this cluster | ||||
| nameservers=$NAMESERVERS # nameservers defined in the site table | ||||
| node=$NODE | ||||
|  | ||||
| if [ -n "$LOGLABEL" ]; then | ||||
|     log_label=$LOGLABEL | ||||
| else | ||||
|     log_label="xcat" | ||||
| fi | ||||
|  | ||||
| if [ -n "$master" ] && [ -n "$domain" ]; then | ||||
|  | ||||
| 	#logger -t xcat "Created /etc/resolv.conf file on $node." | ||||
| 	#logger -t $log_label "Created /etc/resolv.conf file on $node." | ||||
| 	cp $conf_file $conf_file_bak > /dev/null 2>&1 | ||||
| 	echo "search $domain" >$conf_file | ||||
|     if [[ "$nameservers" != "" ]]; then | ||||
| @@ -35,7 +41,7 @@ if [ -n "$master" ] && [ -n "$domain" ]; then | ||||
|     fi | ||||
|  | ||||
| else | ||||
| 	logger -t xcat -p local4.err "Could not create resolv.conf on $node." | ||||
| 	logger -t $log_label -p local4.err "Could not create resolv.conf on $node." | ||||
| 	exit 1 | ||||
| fi | ||||
|  | ||||
|   | ||||
| @@ -27,6 +27,11 @@ if [ -z "$INSTALLDIR" ]; then | ||||
|     INSTALLDIR="/install" | ||||
| fi | ||||
|  | ||||
| if [ -n "$LOGLABEL" ]; then | ||||
|     log_label=$LOGLABEL | ||||
| else | ||||
|     log_label="xcat" | ||||
| fi | ||||
|  | ||||
| mount | grep "$MASTER:$INSTALLDIR on /install" | ||||
| if [ $? -eq 0 ] | ||||
| @@ -42,7 +47,7 @@ mount $MASTER:$INSTALLDIR  /install | ||||
| if [ $? -ne 0 ] | ||||
| then | ||||
|     errmsg="Failed to run mount $MASTER:$INSTALLDIR  /install" | ||||
|     logger -t xcat -p local4.err $errmsg | ||||
|     logger -t $log_label -p local4.err $errmsg | ||||
|     echo $errmsg | ||||
|     exit 1 | ||||
| fi | ||||
|   | ||||
| @@ -33,7 +33,10 @@ use xCAT::Utils; | ||||
| use xCAT::MsgUtils; | ||||
|  | ||||
| # MAIN | ||||
|  | ||||
| my $log_label=$ENV{'LOGLABEL'}; | ||||
| if (!$log_label) { | ||||
|     $log_label="xcat" | ||||
| } | ||||
| my $rc = 0; | ||||
| my $cmd; | ||||
|  | ||||
| @@ -54,7 +57,7 @@ my $dbname = xCAT::Utils->get_DBName; | ||||
| if ($dbname eq "DB2") | ||||
| { | ||||
|     $msg = "odbcsetup:Setting up ODBC for DB2"; | ||||
|     `logger -t xcat -p local4.info $msg`; | ||||
|     `logger -t $log_label -p local4.info $msg`; | ||||
|     &setupdb2odbc; | ||||
|  | ||||
| } | ||||
| @@ -63,19 +66,19 @@ else | ||||
|     if ($dbname eq "MYSQL") | ||||
|     { | ||||
|         $msg = "odbcsetup:Setting up ODBC for MYSQL"; | ||||
|         `logger -t xcat -p local4.info $msg`; | ||||
|         `logger -t $log_label -p local4.info $msg`; | ||||
|         &setupmysqlodbc; | ||||
|     } | ||||
|     else { | ||||
|         if ($dbname eq "PG") | ||||
|         { | ||||
|             $msg = "odbcsetup:Setting up ODBC for PostgreSQL"; | ||||
|             `logger -t xcat -p local4.info $msg`; | ||||
|             `logger -t $log_label -p local4.info $msg`; | ||||
|             &setupPGodbc; | ||||
|         } else { | ||||
|             $msg = | ||||
| "odbcsetup:cfgloc file does not contain MySQL, DB2 or PG,  will not setup ODBC."; | ||||
|             `logger -t xcat -p local4.err  $msg`; | ||||
|             `logger -t $log_label -p local4.err  $msg`; | ||||
|             exit 1; | ||||
|         } | ||||
|     } | ||||
| @@ -114,12 +117,12 @@ sub setupdb2odbc | ||||
|         $cmd = "$::XCATROOT/bin/db2sqlsetup -o -C"; | ||||
|     } | ||||
|     $msg = "odbcsetup: Running Client ODBC setup. \"$cmd\"\n"; | ||||
|     `logger -t xcat -p local4.info $msg`; | ||||
|     `logger -t $log_label -p local4.info $msg`; | ||||
|  | ||||
|     $rc = &runcmd($cmd); | ||||
|  | ||||
|     $msg = "odbcsetup: Client ODBC setup finished.\n"; | ||||
|     `logger -t xcat -p local4.info  $msg`; | ||||
|     `logger -t $log_label -p local4.info  $msg`; | ||||
|  | ||||
|     return $rc; | ||||
|  | ||||
| @@ -137,12 +140,12 @@ sub setupmysqlodbc | ||||
|     my $cmd; | ||||
|     $cmd = "$::XCATROOT/bin/mysqlsetup -o"; | ||||
|     $msg = "odbcsetup: Running Client ODBC setup. \"$cmd\"\n"; | ||||
|     `logger -t xcat -p local4.info $msg`; | ||||
|     `logger -t $log_label -p local4.info $msg`; | ||||
|  | ||||
|     $rc = &runcmd($cmd); | ||||
|  | ||||
|     $msg = "odbcsetup: Client ODBC setup finished.\n"; | ||||
|     `logger -t xcat -p local4.info $msg`; | ||||
|     `logger -t $log_label -p local4.info $msg`; | ||||
|  | ||||
|     return $rc; | ||||
|  | ||||
| @@ -161,12 +164,12 @@ sub setupPGodbc | ||||
|     my $cmd; | ||||
|     $cmd = "$::XCATROOT/bin/pgsqlsetup -o"; | ||||
|     $msg = "odbcsetup: Running Client ODBC setup. \"$cmd\"\n"; | ||||
|     `logger -t xcat -p local4.info $msg`; | ||||
|     `logger -t $log_label -p local4.info $msg`; | ||||
|  | ||||
|     $rc = &runcmd($cmd); | ||||
|  | ||||
|     $msg = "odbcsetup: Client ODBC setup finished.\n"; | ||||
|     `logger -t xcat -p local4.info $msg`; | ||||
|     `logger -t $log_label -p local4.info $msg`; | ||||
|  | ||||
|     return $rc; | ||||
|  | ||||
| @@ -194,7 +197,7 @@ sub runcmd | ||||
|         { | ||||
|             my $msg = "odbcsetup:\"$cmd\" returned rc=$rc \"$::outref\"\n"; | ||||
|             print $msg; | ||||
|             `logger -t xcat -p local4.err $msg`; | ||||
|             `logger -t $log_label -p local4.err $msg`; | ||||
|             return 1; | ||||
|         } | ||||
|     } | ||||
|   | ||||
| @@ -7,10 +7,13 @@ | ||||
| #   which is specified through nfsserver attribute | ||||
| # | ||||
| ##################################################### | ||||
|  | ||||
| my $log_label=$ENV{'LOGLABEL'}; | ||||
| if (!$log_label) { | ||||
|     $log_label="xcat" | ||||
| } | ||||
| if (!$ENV{'NFSSERVER'}) | ||||
| { | ||||
| `logger -t xcat -p local4.err "environment variable does not exist, exiting..."`; | ||||
| `logger -t $log_label -p local4.err "environment variable does not exist, exiting..."`; | ||||
|     exit -1; | ||||
| } | ||||
|  | ||||
| @@ -80,13 +83,13 @@ sub runcmd | ||||
|         $rc = $? >> 8; | ||||
|         if ($rc > 0) | ||||
|         { | ||||
| `logger -t xcat -p local4.err  "runcmd $cmd failed, error message is:"`; | ||||
| `logger -t $log_label -p local4.err  "runcmd $cmd failed, error message is:"`; | ||||
|             my $errmsg; | ||||
|             foreach my $err (@::outref) | ||||
|             { | ||||
|                 $errmsg .= $err; | ||||
|             } | ||||
|             `logger -t xcat  -p local4.err "$errmsg"`; | ||||
|             `logger -t $log_label  -p local4.err "$errmsg"`; | ||||
|             exit -1; | ||||
|         } | ||||
|     } | ||||
|   | ||||
| @@ -33,7 +33,11 @@ if [ "$(uname -s|tr 'A-Z' 'a-z')" = "linux" ];then | ||||
|        . /xcatpost/xcatlib.sh | ||||
|    fi | ||||
| fi | ||||
|  | ||||
| if [ -n "$LOGLABEL" ]; then | ||||
|     log_label=$LOGLABEL | ||||
| else | ||||
|     log_label="xcat" | ||||
| fi | ||||
| op=$1 | ||||
|  | ||||
| net=$2 | ||||
| @@ -806,7 +810,7 @@ if [ "$op" = "add" ]; then | ||||
|         result=`$cmd 2>&1` | ||||
|         code=$? | ||||
|         if [ $code -ne 0 ]; then | ||||
|             logger -t xcat -p local4.err "$cmd\nerror code=$code, result=$result." | ||||
|             logger -t $log_label -p local4.err "$cmd\nerror code=$code, result=$result." | ||||
|             echo "  error code=$code, result=$result." | ||||
|             if [ -f "/etc/debian_version" ];then | ||||
|                 exit 1; | ||||
| @@ -856,7 +860,7 @@ elif [ "$op" = "delete" ]; then | ||||
|         result=`$cmd 2>&1` | ||||
|         code=$? | ||||
|         if [ $code -ne 0 ]; then | ||||
|             logger -t xcat  -p local4.err "$cmd\nerror code=$code, result=$result." | ||||
|             logger -t $log_label  -p local4.err "$cmd\nerror code=$code, result=$result." | ||||
|             echo "  error code=$code, result=$result." | ||||
|         fi | ||||
|     else | ||||
| @@ -909,7 +913,7 @@ elif [ "$op" = "replace" ]; then | ||||
|     result=`$cmd 2>&1` | ||||
|     code=$? | ||||
|     if [ $code -ne 0 ]; then | ||||
|         logger -t xcat -p local4.err "Error: $cmd [error code=$code, result=$result]" | ||||
|         logger -t $log_label -p local4.err "Error: $cmd [error code=$code, result=$result]" | ||||
|         echo "Error: $cmd [error code=$code, result=$result]" | ||||
|         exit 1; | ||||
|     fi | ||||
|   | ||||
| @@ -1,10 +1,15 @@ | ||||
| # IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html | ||||
| if [ -n "$LOGLABEL" ]; then | ||||
|     log_label=$LOGLABEL | ||||
| else | ||||
|     log_label="xcat" | ||||
| fi | ||||
| GRUB="" | ||||
| for i in /boot/grub/grub.conf /boot/grub/menu.lst | ||||
| do | ||||
| 	if [ -r "$i" ] | ||||
| 	then | ||||
| 		logger -t xcat -p local4.info "Install: got GRUB at $i" | ||||
| 		logger -t $log_label -p local4.info "Install: got GRUB at $i" | ||||
| 		GRUB=$i | ||||
| 		GRUBDIR=$(dirname $GRUB) | ||||
| 		GRUBFILE=$(basename $GRUB) | ||||
| @@ -14,7 +19,7 @@ done | ||||
|  | ||||
| if [ -n "$GRUB" ] | ||||
| then | ||||
|         logger -t xcat -p local4.info "Install: the GRUB dir is $GRUBDIR" | ||||
|         logger -t $log_label -p local4.info "Install: the GRUB dir is $GRUBDIR" | ||||
| 	cd $GRUBDIR | ||||
| 	perl -pi -e 's/^gfxmenu/#gfxmenu/' $GRUBFILE | ||||
| 	perl -pi -e 's/^color/#color/' $GRUBFILE | ||||
|   | ||||
| @@ -10,7 +10,11 @@ | ||||
| #   on Redhat-family OSes with POWER system | ||||
| # | ||||
| #----------------------------------------------------------------------------- | ||||
|  | ||||
| if [ -n "$LOGLABEL" ]; then | ||||
|     log_label=$LOGLABEL | ||||
| else | ||||
|     log_label="xcat" | ||||
| fi | ||||
| OS=`uname` | ||||
| if [[ $OS = "Linux" ]]; then | ||||
|     if [[ $OSVER = fedora* ]] || [[ $OSVER = rhels5* ]] || [[ $OSVER = rhel6* ]] || [[ $OSVER=rhels6* ]] || [[ -f /etc/fedora-release ]] || [[ -f /etc/redhat-release ]]; then | ||||
| @@ -36,13 +40,13 @@ if [[ $OS = "Linux" ]]; then | ||||
|                 then | ||||
|                     if echo $MPATH | grep "sdd" | ||||
|                     then | ||||
|                         logger -t xcat -p local4.info setbootfromdisk: Setting sda sdb sdc sdd to be the default bootup device | ||||
|                         logger -t $log_label -p local4.info setbootfromdisk: Setting sda sdb sdc sdd to be the default bootup device | ||||
|                         echo "setbootfromdisk: setting up sda sdb sdc sdd to be the default bootup device" | ||||
|                         bootlist -m normal sda sdb sdc sdd | ||||
|                         exit 0 | ||||
|                     fi | ||||
|                 fi | ||||
|                 logger -t xcat -p local4.info setbootfromdisk: Setting sda sdb to be the default bootup device | ||||
|                 logger -t $log_label -p local4.info setbootfromdisk: Setting sda sdb to be the default bootup device | ||||
|                 echo "setbootfromdisk: setting up sda sdb to be the default bootup device for software raid" | ||||
|                 bootlist -m normal sda sdb | ||||
|                 exit 0 | ||||
| @@ -67,13 +71,13 @@ if [[ $OS = "Linux" ]]; then | ||||
|                     then | ||||
|                         if echo $i | grep "sda" | ||||
|                         then | ||||
|                             logger -t xcat -p local4.info setbootfromdisk: Setting sda sdb to be the default bootup device | ||||
|                             logger -t $log_label -p local4.info setbootfromdisk: Setting sda sdb to be the default bootup device | ||||
|                             echo "setbootfromdisk: setting up sda sdb to be the default bootup device" | ||||
|                             bootlist -m normal sda sdb | ||||
|                             exit 0 | ||||
|                         elif echo $i | grep "sdc" | ||||
|                         then | ||||
|                             logger -t xcat -p local4.info setbootfromdisk: Setting sdc sdd to be the default bootup device | ||||
|                             logger -t $log_label -p local4.info setbootfromdisk: Setting sdc sdd to be the default bootup device | ||||
|                             echo "setbootfromdisk: setting up sdc sdd to be the default bootup device" | ||||
|                             bootlist -m normal sdc sdd | ||||
|                             exit 0 | ||||
| @@ -84,7 +88,7 @@ if [[ $OS = "Linux" ]]; then | ||||
|  | ||||
|                 if echo $MPATH | grep "sdb" | ||||
|                 then | ||||
|                     logger -t xcat -p local4.info setbootfromdisk: Setting sda sdb to be the default bootup device | ||||
|                     logger -t $log_label -p local4.info setbootfromdisk: Setting sda sdb to be the default bootup device | ||||
|                     echo "setbootfromdisk: setting up sda sdb to be the default bootup device" | ||||
|                     bootlist -m normal sda sdb | ||||
|                     exit 0 | ||||
| @@ -92,15 +96,15 @@ if [[ $OS = "Linux" ]]; then | ||||
|             fi | ||||
|  | ||||
|             if [[ -z $BOOTDEVICE ]]; then | ||||
|                 logger -t xcat -p local4.err setbootfromdisk: cannot find the booting device | ||||
|                 logger -t $log_label -p local4.err setbootfromdisk: cannot find the booting device | ||||
|             else | ||||
|                 logger -t xcat -p local4.info setbootfromdisk: Setting $BOOTDEVICE to be the default bootup device | ||||
|                 logger -t $log_label -p local4.info setbootfromdisk: Setting $BOOTDEVICE to be the default bootup device | ||||
|                 echo "setbootfromdisk: setting up $BOOTDEVICE as the default bootup device" | ||||
|                 bootlist -m normal $BOOTDEVICE | ||||
|                 exit 0 | ||||
|             fi | ||||
|         else | ||||
|             logger -t xcat -p local4.err Could not find /usr/sbin/bootlist | ||||
|             logger -t $log_label -p local4.err Could not find /usr/sbin/bootlist | ||||
|             echo "setbootfromdisk: could not find /usr/sbin/bootlist" | ||||
|             exit -1 | ||||
|         fi | ||||
|   | ||||
| @@ -15,12 +15,16 @@ | ||||
| #----------------------------------------------------------------------------- | ||||
| NODE_NAME=$NODE | ||||
| GATE_WAY=$GATEWAY | ||||
|  | ||||
| if [ -n "$LOGLABEL" ]; then | ||||
|     log_label=$LOGLABEL | ||||
| else | ||||
|     log_label="xcat" | ||||
| fi | ||||
| OS=`uname` | ||||
| if [ -z $MASTER ]; then | ||||
|     msg="$0: The environment variable MASTER is null, pls check.\n" | ||||
|     echo $msg | ||||
|     logger -t xcat -p local4.err "$msg" | ||||
|     logger -t $log_label -p local4.err "$msg" | ||||
|     exit 1 | ||||
| fi | ||||
|  | ||||
| @@ -38,7 +42,7 @@ else | ||||
|     if [ $SRET -ne 0 ]; then | ||||
|         msg="$0: The returned value is not correct, server_ip=$SERVER_IP\n" | ||||
|         echo $msg | ||||
|         logger -t xcat -p local4.err "$msg" | ||||
|         logger -t $log_label -p local4.err "$msg" | ||||
|         exit 1 | ||||
|     fi | ||||
| fi | ||||
| @@ -58,13 +62,13 @@ if [ ! -z $NODE_NAME ]; then | ||||
| else | ||||
|    msg="$0: The environment variable NODE is null, pls check.\n" | ||||
|    echo $msg | ||||
|    logger -t xcat -p local4.err "$msg" | ||||
|    logger -t $log_label -p local4.err "$msg" | ||||
|    exit 1 | ||||
| fi | ||||
|  | ||||
| if [[ $RET -ne 0 ]] || [[ $NRET -ne 0 ]]; then | ||||
|    msg="$0: The returned value is not correct, client_ip=$client_ip, nic=$nic\n" | ||||
|    logger -t xcat -p local4.info "$msg" | ||||
|    logger -t $log_label -p local4.info "$msg" | ||||
|    exit 1 | ||||
| fi | ||||
|  | ||||
| @@ -77,7 +81,7 @@ if [ ! -z $NIC ]; then | ||||
| else | ||||
|    msg="$0: The network interface NIC on the host $CLIENT_IP is not retrieved, pls check.\n" | ||||
|    echo $msg | ||||
|    logger -t xcat -p local4.info "$msg" | ||||
|    logger -t $log_label -p local4.info "$msg" | ||||
|    exit 1 | ||||
| fi | ||||
|  | ||||
|   | ||||
| @@ -6,13 +6,16 @@ BEGIN { | ||||
| 	initrd = ARGV[4] | ||||
| 	kcmd = ARGV[5] | ||||
| 	ns = "/inet/tcp/0/" ARGV[1] "/" xcatdport | ||||
|  | ||||
|         log_label=ENVIRON["LOGLABEL"] | ||||
|         if(!log_label){ | ||||
|             log_label="xcat" | ||||
|         } | ||||
| 	while(1) { | ||||
|                 if((ns |& getline) > 0) | ||||
|                         print $0 | "logger -t xcat -p local4.info" | ||||
|                         print $0 | "logger -t "log_label" -p local4.info" | ||||
|                 else { | ||||
|                     print "Retrying iSCSI paramater config script" | ||||
|                     print "Retrying iSCSI paramater config script" | "logger -t xcat -p local4.info" | ||||
|                     print "Retrying iSCSI paramater config script" | "logger -t "log_label" -p local4.info" | ||||
|                     close(ns) | ||||
|                     system("sleep 1") | ||||
|                 } | ||||
|   | ||||
| @@ -5,11 +5,15 @@ | ||||
| # setup LDAP client configuration on the compute nodes | ||||
| # | ||||
| #--------------------------------------------------------------------------- | ||||
|  | ||||
| if [ -n "$LOGLABEL" ]; then | ||||
|     log_label=$LOGLABEL | ||||
| else | ||||
|     log_label="xcat" | ||||
| fi | ||||
| if [ -r /etc/ldap.conf -a -r /etc/resolv.conf ] | ||||
|         then | ||||
|             echo -n "         LDAP: " | ||||
| 	     logger -t xcat -p local4.info "         LDAP: " | ||||
| 	     logger -t $log_label -p local4.info "         LDAP: " | ||||
|             DC=$( | ||||
|                 cat /etc/resolv.conf | \ | ||||
|                 egrep '(domain|search)' | \ | ||||
|   | ||||
| @@ -2,13 +2,17 @@ | ||||
| # example on how to set up ESX.  We setup ssh and also add a basic | ||||
| # VLAN configuration | ||||
|  | ||||
|  | ||||
| if [ -n "$LOGLABEL" ]; then | ||||
|     log_label=$LOGLABEL | ||||
| else | ||||
|     log_label="xcat" | ||||
| fi | ||||
| if [ "$(uname -s|tr 'A-Z' 'a-z')" = "linux" ];then | ||||
|    str_dir_name=`dirname $0` | ||||
|    . $str_dir_name/xcatlib.sh | ||||
| fi | ||||
|  | ||||
| logger -t xcat -p local4.info setupesx | ||||
| logger -t $log_label -p local4.info setupesx | ||||
| # Enable SSH access to root and exchange keys | ||||
|  | ||||
| sed -e 's/PermitRootLogin no/PermitRootLogin yes/' /etc/ssh/sshd_config > /etc/ssh/sshd_config.new | ||||
| @@ -18,7 +22,7 @@ restartservice ssh | ||||
|  | ||||
| if [ -r /etc/ssh/sshd_config ] | ||||
| then | ||||
|         logger -t xcat -p local4.info "Install: setup /etc/ssh/sshd_config" | ||||
|         logger -t $log_label -p local4.info "Install: setup /etc/ssh/sshd_config" | ||||
|         cp /etc/ssh/sshd_config /etc/ssh/sshd_config.ORIG | ||||
|         sed -i 's/^X11Forwarding .*$/X11Forwarding yes/' /etc/ssh/sshd_config | ||||
|         sed -i 's/^KeyRegenerationInterval .*$/KeyRegenerationInterval 0/' /etc/ssh/sshd_config | ||||
| @@ -34,7 +38,7 @@ fi | ||||
|  | ||||
| if [ -d /xcatpost/_ssh ] | ||||
| then | ||||
|         logger -t xcat -p local4.info "Install: setup root .ssh" | ||||
|         logger -t $log_label -p local4.info "Install: setup root .ssh" | ||||
|         cd /xcatpost/_ssh | ||||
|         mkdir -p /root/.ssh | ||||
|         cp -f * /root/.ssh | ||||
| @@ -66,7 +70,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 -p local4.info "Install: restart syslog" | ||||
| logger -t $log_label -p local4.info "Install: restart syslog" | ||||
| #service syslog restart | ||||
| restartservice syslog | ||||
|  | ||||
|   | ||||
| @@ -7,7 +7,10 @@ | ||||
| #   It only works on AIX for now | ||||
| # | ||||
| ##################################################### | ||||
|  | ||||
| my $log_label=$ENV{'LOGLABEL'}; | ||||
| if (!$log_label) { | ||||
|     $log_label="xcat" | ||||
| } | ||||
| # Change these two parameters according to your requirements | ||||
| $::NFSRETRIES = 3; | ||||
| $::NFSTIMEO   = 50; | ||||
| @@ -57,13 +60,13 @@ sub runcmd | ||||
|         $rc = $? >> 8; | ||||
|         if ($rc > 0) | ||||
|         { | ||||
| `logger -t xcat -p local4.err "runcmd $cmd failed, error message is:"`; | ||||
| `logger -t $log_label -p local4.err "runcmd $cmd failed, error message is:"`; | ||||
|             my $errmsg; | ||||
|             foreach my $err (@::outref) | ||||
|             { | ||||
|                 $errmsg .= $err; | ||||
|             } | ||||
|             `logger -t xcat -p local4.err "$errmsg"`; | ||||
|             `logger -t $log_label -p local4.err "$errmsg"`; | ||||
|  | ||||
|             exit; | ||||
|         } | ||||
|   | ||||
| @@ -14,7 +14,11 @@ | ||||
|  | ||||
| PATH="/usr/sbin:/usr/bin:/sbin:/bin" | ||||
| export PATH | ||||
|  | ||||
| if [ -n "$LOGLABEL" ]; then | ||||
|     log_label=$LOGLABEL | ||||
| else | ||||
|     log_label="xcat" | ||||
| fi | ||||
| # | ||||
| # warn_if_bad           Put out warning message(s) if $1 has bad RC. | ||||
| # | ||||
| @@ -33,7 +37,7 @@ function warn_if_bad() | ||||
|  | ||||
| 	# Broken | ||||
| 	shift | ||||
| 	logger -t xcat -p local4.info "${script}: $@" >/dev/null 2>&1 | ||||
| 	logger -t $log_label -p local4.info "${script}: $@" >/dev/null 2>&1 | ||||
| 	echo "${script}: $@" >&2 | ||||
| 	return "${rc}" | ||||
| } | ||||
| @@ -130,7 +134,7 @@ check_executes chronyd >/dev/null 2>&1 || USE_NTPD="yes" | ||||
| if [ -n "${USE_NTPD}" ] | ||||
| then | ||||
| 	# Call setupntp.traditional, and pass the parsed ntp servers | ||||
| 	logger -t xcat -p local4.info "Will call setupntp.traditional" | ||||
| 	logger -t $log_label -p local4.info "Will call setupntp.traditional" | ||||
| 	export NTPSERVERS="$(IFS=','; echo "${NTP_SERVERS[*]:-pool.ntp.org}")" | ||||
| 	exec "${0%/*}/setupntp.traditional" | ||||
| 	exit 255 | ||||
| @@ -161,7 +165,7 @@ timedatectl set-local-rtc 0 | ||||
| warn_if_bad "$?" "Failed to configure the system to maintain the RTC in universal time" | ||||
|  | ||||
| # Synchronize and set the system clock once | ||||
| logger -t xcat -p local4.info "Syncing the clock ..." | ||||
| logger -t $log_label -p local4.info "Syncing the clock ..." | ||||
| chronyd -f /dev/null -q "$( | ||||
| 	if [ "${#NTP_SERVERS[@]}" -gt "0" ] | ||||
| 	then | ||||
| @@ -235,7 +239,7 @@ DRIFT_FILE="$( | ||||
|  | ||||
| LOG_DIR="/var/log/chrony" | ||||
|  | ||||
| logger -t xcat -p local4.info "Install: Setup NTP - chrony" | ||||
| logger -t $log_label -p local4.info "Install: Setup NTP - chrony" | ||||
| cp "${CHRONY_CONF}" "${CHRONY_CONF}.xcatsave" | ||||
| cat >"${CHRONY_CONF}" <<EOF | ||||
| # This chrony configuration file is generated by xCAT | ||||
| @@ -302,7 +306,7 @@ systemctl reload-or-restart chrony.service 2>/dev/null || | ||||
| 	systemctl reload-or-restart chronyd.service 2>/dev/null | ||||
| exit_if_bad "$?" "Failed to start chrony service" | ||||
|  | ||||
| logger -t xcat -p local4.info "NTP setup accomplished!" | ||||
| logger -t $log_label -p local4.info "NTP setup accomplished!" | ||||
|  | ||||
| exit 0 | ||||
|  | ||||
|   | ||||
| @@ -10,10 +10,14 @@ if [ "$(uname -s|tr 'A-Z' 'a-z')" = "linux" ];then | ||||
|    str_dir_name=`dirname $0` | ||||
|    . $str_dir_name/xcatlib.sh | ||||
| fi | ||||
|  | ||||
| if [ -n "$LOGLABEL" ]; then | ||||
|     log_label=$LOGLABEL | ||||
| else | ||||
|     log_label="xcat" | ||||
| fi | ||||
| # if on the Management Node | ||||
| if [ -e /etc/xCATMN ]; then | ||||
|    logger -t xcat -p local4.info "setupntp: This postscript does not support running on the management node. Please run makentp command. exiting" | ||||
|    logger -t $log_label -p local4.info "setupntp: This postscript does not support running on the management node. Please run makentp command. exiting" | ||||
|    exit 0 | ||||
| fi | ||||
|  | ||||
| @@ -43,7 +47,7 @@ is_lsb_cumulus () | ||||
|   return $? | ||||
| } | ||||
|  | ||||
| logger -t xcat "Install: Setup NTP" | ||||
| logger -t $log_label "Install: Setup NTP" | ||||
| # Use the ntpservers defined in the site table, if they exist. | ||||
| # If the value of ntpservers is <xcatmaster> use the service node or | ||||
| # the management node as the ntp server. | ||||
| @@ -117,12 +121,12 @@ if [ $OS_TYPE = Linux ]; then | ||||
|     fi | ||||
|  | ||||
|     msg='syncing the clock ...' | ||||
|     logger -t xcat $msg | ||||
|     logger -t $log_label $msg | ||||
|     echo $msg | ||||
|     if ! timeout 120 ntpd -gq  > /dev/null 2>&1 ; then | ||||
|         if ! ntpdate -t5 $master > /dev/null 2>&1; then | ||||
|             msg='WARNING: NTP Sync Failed before timeout. ntp server will try to sync...' | ||||
|             logger -t xcat $msg | ||||
|             logger -t $log_label $msg | ||||
|             echo $msg | ||||
|         fi | ||||
|     fi | ||||
| @@ -193,12 +197,12 @@ broadcastclient | ||||
| restrict 127.0.0.1" >>$conf_file | ||||
|  | ||||
|     stopsrc -s xntpd | ||||
|     logger -t xcat "ntpdate -t5 $master " | ||||
|     logger -t $log_label "ntpdate -t5 $master " | ||||
|     ntpdate -t5 $master | ||||
|     if [ "$?" != "0" ] | ||||
|     then | ||||
|         echo "  ntpdate -t5 $master  failed " | ||||
|         logger -t xcat "ntpdate -t5 $master failed" | ||||
|         logger -t $log_label "ntpdate -t5 $master failed" | ||||
|     fi | ||||
|     /usr/sbin/chrctcp -S -a xntpd | ||||
| fi | ||||
|   | ||||
| @@ -10,13 +10,17 @@ | ||||
| #        postscripts.postbootscripts will be run when the node reboots. | ||||
| #=cut | ||||
| #------------------------------------------------------------------------------- | ||||
|  | ||||
| if [ -n "$LOGLABEL" ]; then | ||||
|     log_label=$LOGLABEL | ||||
| else | ||||
|     log_label="xcat" | ||||
| fi | ||||
| #only works for diskful nodes | ||||
| if [ "$NODESETSTATE" = "netboot" -o \ | ||||
|      "$NODESETSTATE" = "statelite" -o \ | ||||
|      "$NODESETSTATE" = "diskless" -o \ | ||||
|      "$NODESETSTATE" = "dataless" ]; then | ||||
|     logger -t xcat -p local4.info "setuppostbootscripts: Nothing to do for stateless and statelite nodes." | ||||
|     logger -t $log_label -p local4.info "setuppostbootscripts: Nothing to do for stateless and statelite nodes." | ||||
|     exit 0 | ||||
| fi | ||||
|  | ||||
| @@ -34,7 +38,7 @@ fi | ||||
| if [ -f $infofile ]; then | ||||
|     value=`grep "RUNBOOTSCRIPTS=$RUNBOOTSCRIPTS" $infofile` | ||||
|     if [[ -n $value ]]; then  # match | ||||
|       logger -t xcat -p local4.info "setuppostbootscripts: xcatinfo uptodate, nothing to do." | ||||
|       logger -t $log_label -p local4.info "setuppostbootscripts: xcatinfo uptodate, nothing to do." | ||||
|       exit 0 | ||||
|     fi | ||||
| fi | ||||
|   | ||||
| @@ -8,7 +8,11 @@ | ||||
| # | ||||
| #==================================================================== | ||||
| ME="setupscratch" | ||||
|  | ||||
| if [ -n "$LOGLABEL" ]; then | ||||
|     log_label=$LOGLABEL | ||||
| else | ||||
|     log_label="xcat" | ||||
| fi | ||||
| mydir="/scratch" | ||||
| umount $mydir | ||||
|  | ||||
| @@ -17,13 +21,13 @@ then | ||||
|     if grep sda1 /proc/partitions >/dev/null 2>&1 | ||||
|     then | ||||
| 	    echo Autodetected existing /dev/sda1 | ||||
| 	    logger -t xcat -p local4.info $ME Autodetected existing /dev/sda1 | ||||
| 	    logger -t $log_label -p local4.info $ME Autodetected existing /dev/sda1 | ||||
| 	    echo Checking filesystem /dev/sda1 | ||||
| 	    logger -t xcat -p local4.info $ME Checking filesystem /dev/sda1 | ||||
| 	    logger -t $log_label -p local4.info $ME Checking filesystem /dev/sda1 | ||||
| 	    fsck -y /dev/sda1 | ||||
| 	    mkdir -p $mydir | ||||
| 	    echo mounting existing /dev/sda1 to $mydir | ||||
| 	    logger -t xcat -p local4.info $ME mounting existing /dev/sda1 to $mydir | ||||
| 	    logger -t $log_label -p local4.info $ME mounting existing /dev/sda1 to $mydir | ||||
| 	    if mount /dev/sda1 $mydir | ||||
| 	    then | ||||
| 		    echo | ||||
| @@ -32,14 +36,14 @@ then | ||||
| 		    exit 0 | ||||
| 	    else | ||||
| 		    echo mounting /dev/sda1 to $mydir failed | ||||
| 		    logger -t xcat -p local4.warning  $ME mounting /dev/sda1 to $mydir failed | ||||
| 		    logger -t $log_label -p local4.warning  $ME mounting /dev/sda1 to $mydir failed | ||||
| 	    fi | ||||
|     fi | ||||
| fi | ||||
|  | ||||
|  | ||||
| echo Creating Partition | ||||
| logger -t xcat -p local4.info $ME Creating Partition | ||||
| logger -t $log_label -p local4.info $ME Creating Partition | ||||
| parted -s /dev/sda mklabel gpt | ||||
| parted -s -- /dev/sda mkpart primary ext3 0 -0 | ||||
| if grep sda1 /proc/partitions >/dev/null 2>&1 | ||||
| @@ -47,7 +51,7 @@ then | ||||
| 	sleep 5 | ||||
| else | ||||
| 	echo failed to create partition, exiting $ME | ||||
| 	logger -t xcat -p local4.err  $ME failed to create partition, exiting $ME | ||||
| 	logger -t $log_label -p local4.err  $ME failed to create partition, exiting $ME | ||||
| 	echo | ||||
| 	echo Failed! | ||||
| 	echo | ||||
| @@ -55,11 +59,11 @@ else | ||||
| fi | ||||
|  | ||||
| echo Creating new ext3 filesystem: /dev/sda1 | ||||
| logger -t xcat -p local4.info $ME Creating new ext3 filesystem: /dev/sda1 | ||||
| logger -t $log_label -p local4.info $ME Creating new ext3 filesystem: /dev/sda1 | ||||
| mke2fs -j /dev/sda1 | ||||
| mkdir -p $mydir | ||||
| echo mounting new /dev/sda1 to $mydir | ||||
| logger -t xcat -p local4.info $ME mounting new /dev/sda1 to $mydir | ||||
| logger -t $log_label -p local4.info $ME mounting new /dev/sda1 to $mydir | ||||
| mount /dev/sda1 $mydir | ||||
| echo | ||||
| echo Done! | ||||
|   | ||||
| @@ -7,7 +7,11 @@ | ||||
| # | ||||
| #------------------------------------------------------------------------------ | ||||
|  | ||||
|  | ||||
| if [ -n "$LOGLABEL" ]; then | ||||
|     log_label=$LOGLABEL | ||||
| else | ||||
|     log_label="xcat" | ||||
| fi | ||||
|  | ||||
| if [ "$(uname -s|tr 'A-Z' 'a-z')" = "linux" ];then | ||||
|    str_dir_name=`dirname $0` | ||||
| @@ -59,7 +63,7 @@ chown $SUDOER:users $HOME/.ssh/authorized_keys | ||||
|  | ||||
|  | ||||
| # Restart the SSHD for syncfiles postscript to do the sync work | ||||
| logger -t xcat -p local4.info "Restarting SSHD" | ||||
| logger -t $log_label -p local4.info "Restarting SSHD" | ||||
| #if [ -f "/etc/debian_version" ];then | ||||
| #    service ssh restart | ||||
| #else | ||||
|   | ||||
| @@ -2,9 +2,13 @@ | ||||
| # IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html | ||||
| #(C)IBM Corp | ||||
| # | ||||
|  | ||||
| if [ -n "$LOGLABEL" ]; then | ||||
|     log_label=$LOGLABEL | ||||
| else | ||||
|     log_label="xcat" | ||||
| fi | ||||
| result=`umount /post 2>&1` | ||||
| returncode=$? | ||||
| logger -t xcat -p local4.info $result | ||||
| logger -t $log_label -p local4.info $result | ||||
| exit $returncode | ||||
|  | ||||
|   | ||||
| @@ -4,13 +4,16 @@ BEGIN { | ||||
| 	xcatdport = ARGV[2] | ||||
|  | ||||
| 	ns = "/inet/tcp/0/" ARGV[1] "/" xcatdport | ||||
|  | ||||
|         log_label=ENVIRON["LOGLABEL"] | ||||
|         if(!log_label){ | ||||
|             log_label="xcat" | ||||
|         } | ||||
| 	 while(1) { | ||||
|                 if((ns |& getline) > 0) | ||||
|                         print $0 | "logger -t xcat -p local4.info " | ||||
|                         print $0 | "logger -t "log_label" -p local4.info " | ||||
|                 else { | ||||
|                     print "Retrying unlock of tftp directory" | ||||
|                     print "$0: Retrying unlock of tftp directory" | "logger -t xcat -p local4.info " | ||||
|                     print "$0: Retrying unlock of tftp directory" | "logger -t "log_label" -p local4.info " | ||||
|                     close(ns) | ||||
|                     system("sleep 5") | ||||
|                 } | ||||
|   | ||||
| @@ -8,18 +8,23 @@ | ||||
| # The -d flag was implemented when the call to the routine was moved | ||||
| # from the postscript table into the servicenode postscript. | ||||
| # | ||||
| if [ -n "$LOGLABEL" ]; then | ||||
|     log_label=$LOGLABEL | ||||
| else | ||||
|     log_label="xcat" | ||||
| fi | ||||
| if [ ! $1 ]; then | ||||
|    logger -t xcat -p local4.err "xcatclient call without -d, doing nothing." | ||||
|    logger -t $log_label -p local4.err "xcatclient call without -d, doing nothing." | ||||
|    exit 0 | ||||
| fi | ||||
| if [ $1 != "-d" ]; then | ||||
|    logger -t xcat  -p local4.err "xcatclient call without -d, doing nothing." | ||||
|    logger -t $log_label  -p local4.err "xcatclient call without -d, doing nothing." | ||||
|    exit 0 | ||||
| fi | ||||
| logger -t xcat -p local4.info "xcatclient call with -d. getting credentials and cfgloc " | ||||
| logger -t $log_label -p local4.info "xcatclient call with -d. getting credentials and cfgloc " | ||||
|  | ||||
| if [ ! -x /usr/bin/openssl ]; then #Unless we have openssl stup | ||||
|    logger -t xcat -p local4.err "$0: /usr/bin/openssl is not executable" | ||||
|    logger -t $log_label -p local4.err "$0: /usr/bin/openssl is not executable" | ||||
|    exit -1 | ||||
| fi | ||||
| USEOPENSSLFORXCAT=1 #Declare 2.3 style SSL | ||||
| @@ -44,7 +49,7 @@ export USEOPENSSLFORXCAT | ||||
|      done | ||||
|    else | ||||
|      ERR_MSG=`sed -n 's%.*<error>\(.*\)</error>.*%\1%p' /tmp/xcat_client_cred` | ||||
|      logger -t xcat -p local4.err xcat_client_cred Error: $ERR_MSG | ||||
|      logger -t $log_label -p local4.err xcat_client_cred Error: $ERR_MSG | ||||
|      RETURNVAL=-1 | ||||
|    fi | ||||
|    rm /tmp/xcat_client_cred | ||||
|   | ||||
| @@ -14,13 +14,17 @@ | ||||
| # Short-Description: xCATpost | ||||
| # Description: xCAT post boot script | ||||
| ### END INIT INFO | ||||
|  | ||||
| if [ -n "$LOGLABEL" ]; then | ||||
|     log_label=$LOGLABEL | ||||
| else | ||||
|     log_label="xcat" | ||||
| fi | ||||
| # Source function library. | ||||
| if [ -x /etc/rc.d/init.d/functions ]; then | ||||
|   . /etc/rc.d/init.d/functions | ||||
| fi | ||||
|  | ||||
| logger -t xcat -p local4.info "$0: action is $1" | ||||
| logger -t $log_label -p local4.info "$0: action is $1" | ||||
| case $1 in | ||||
| restart) | ||||
|   $0 stop | ||||
| @@ -28,11 +32,11 @@ restart) | ||||
|   ;; | ||||
| status) | ||||
|   echo -n "xcatpostinit runs only at boot, runs additional post scripts" | ||||
|   logger -t xcat -p local4.info "xcatpostinit runs only at boot, runs additional post scripts" | ||||
|   logger -t $log_label -p local4.info "xcatpostinit runs only at boot, runs additional post scripts" | ||||
|   ;; | ||||
| stop) | ||||
|   echo -n "nothing to stop " | ||||
|   logger -t xcat -p local4.info "nothing to stop" | ||||
|   logger -t $log_label -p local4.info "nothing to stop" | ||||
|   ;; | ||||
| start) | ||||
|         # Node is stateless by default | ||||
| @@ -59,10 +63,10 @@ start) | ||||
|  | ||||
|         # Run $SCRIPT according to node type | ||||
|         if [ $STATELITE -ne 0 ]; then | ||||
|             logger -t xcat -p local4.info "Call $SCRIPT for statelite mode" | ||||
|             logger -t $log_label -p local4.info "Call $SCRIPT for statelite mode" | ||||
|             "$SCRIPT" 4 | ||||
|         else | ||||
|             logger -t xcat -p local4.info  "Call $SCRIPT for stateless mode" | ||||
|             logger -t $log_label -p local4.info  "Call $SCRIPT for stateless mode" | ||||
|             "$SCRIPT" | ||||
|         fi | ||||
|   ;; | ||||
|   | ||||
| @@ -7,24 +7,29 @@ | ||||
| # The -d flag was implemented when the call to the routine was moved | ||||
| # from the postscript table into the servicenode postscript. | ||||
| # | ||||
| if [ -n "$LOGLABEL" ]; then | ||||
|     log_label=$LOGLABEL | ||||
| else | ||||
|     log_label="xcat" | ||||
| fi | ||||
| if [ ! $1 ]; then | ||||
|    logger -t xcat -p local4.err "xcatserver call without -d, doing nothing." | ||||
|    logger -t $log_label -p local4.err "xcatserver call without -d, doing nothing." | ||||
|    #echo "xcatserver call without -d, doing nothing." | ||||
|    #echo $1 | ||||
|    exit 0 | ||||
| fi | ||||
| if [ $1 != "-d" ]; then | ||||
|    logger -t xcat -p local4.err "xcatserver call without -d, doing nothing." | ||||
|    logger -t $log_label -p local4.err "xcatserver call without -d, doing nothing." | ||||
|    #echo "xcatserver call without -d, doing nothing." | ||||
|    #echo $1 | ||||
|    exit 0 | ||||
| fi | ||||
| logger -t xcat -p local4.info "xcatserver call with -d. getting credentials and cfgloc " | ||||
| logger -t $log_label -p local4.info "xcatserver call with -d. getting credentials and cfgloc " | ||||
| #echo "xcatserver call with -d, getting credentials and cfgloc." | ||||
| #echo $1 | ||||
|  | ||||
| if [ ! -x /usr/bin/openssl ]; then | ||||
|    logger -t xcat -p local4.err "$0: /usr/bin/openssl is not executable" | ||||
|    logger -t $log_label -p local4.err "$0: /usr/bin/openssl is not executable" | ||||
|    exit -1 | ||||
| fi | ||||
| USEOPENSSLFORXCAT=1 | ||||
| @@ -47,12 +52,12 @@ sleep 1 | ||||
| mkdir -p /etc/xcat/cert | ||||
| if [ $useflowcontrol = "1" ]; then | ||||
|   #first contact daemon  xcatflowrequest <server> 3001 | ||||
|   logger -t xcat -p local4.info "xcatserver: sending xcatflowrequest $master 3001" | ||||
|   logger -t $log_label -p local4.info "xcatserver: sending xcatflowrequest $master 3001" | ||||
|  /$xcatpost/xcatflowrequest $master 3001 | ||||
|  rc=$? | ||||
|  logger -t xcat -p local4.info "xcatserver:xcatflowrequest received response return=$rc" | ||||
|  logger -t $log_label -p local4.info "xcatserver:xcatflowrequest received response return=$rc" | ||||
|  if [ $rc -ne 0 ]; then | ||||
|       logger -t xcat -p local4.info "xcatserver: error from xcatflowrequest, will not use flow control" | ||||
|       logger -t $log_label -p local4.info "xcatserver: error from xcatflowrequest, will not use flow control" | ||||
|       useflowcontrol=0 | ||||
|  fi | ||||
|  | ||||
| @@ -64,7 +69,7 @@ getcredentials.awk xcat_server_cred | grep -v '<'|sed -e 's/</</' -e 's/>/ | ||||
| grep -E '<error>' /etc/xcat/cert/server-cred.pem | ||||
| if [ $? -ne 0 ]; then | ||||
|         #the message received is the data | ||||
|    logger -t xcat -p local4.info "xcatserver: getting server-cred.pem" | ||||
|    logger -t $log_label -p local4.info "xcatserver: getting server-cred.pem" | ||||
|     MAX_RETRIES=10 | ||||
|     RETRY=0 | ||||
|     MYCONT=`cat /etc/xcat/cert/server-cred.pem` | ||||
| @@ -84,12 +89,12 @@ if [ $? -ne 0 ]; then | ||||
|                 fi | ||||
|                 if [ $useflowcontrol = "1" ]; then | ||||
|                   #first contact daemon  xcatflowrequest <server> 3001 | ||||
|                   logger -t xcat -p local4.info "xcatserver: sending xcatflowrequest $master 3001" | ||||
|                   logger -t $log_label -p local4.info "xcatserver: sending xcatflowrequest $master 3001" | ||||
|                   /$xcatpost/xcatflowrequest $master 3001 | ||||
|                   rc=$? | ||||
|                   logger -t xcat -p local4.info "xcatserver:xcatflowrequest return=$rc" | ||||
|                   logger -t $log_label -p local4.info "xcatserver:xcatflowrequest return=$rc" | ||||
|                   if [ $rc -ne 0 ]; then | ||||
|                     logger -t xcat -p local4.info "xcatserver: error from xcatflowrequest, will not use flow control" | ||||
|                     logger -t $log_label -p local4.info "xcatserver: error from xcatflowrequest, will not use flow control" | ||||
|                     useflowcontrol=0 | ||||
|                   fi | ||||
|                 fi | ||||
| @@ -103,7 +108,7 @@ if [ $? -ne 0 ]; then | ||||
| else  # error from first getcredential call | ||||
|         #the message received is an error from credentials.pm, so parse it | ||||
|         ERR_MSG=`sed -n 's%.*<error>\(.*\)</error>.*%\1%p' /etc/xcat/cert/server-cred.pem` | ||||
|         logger -t xcat -p local4.err xcatserver: $ERR_MSG | ||||
|         logger -t $log_label -p local4.err xcatserver: $ERR_MSG | ||||
|         rm /etc/xcat/cert/server-cred.pem | ||||
| fi | ||||
|  | ||||
| @@ -111,12 +116,12 @@ fi | ||||
|  | ||||
| if [ $useflowcontrol = "1" ]; then | ||||
|   #first contact daemon  xcatflowrequest <server> 3001 | ||||
|   logger -t xcat -p local4.info "xcatserver: sending xcatflowrequest $master 3001" | ||||
|   logger -t $log_label -p local4.info "xcatserver: sending xcatflowrequest $master 3001" | ||||
|  /$xcatpost/xcatflowrequest $master 3001 | ||||
|  rc=$? | ||||
|  logger -t xcat -p local4.info "xcatserver:xcatflowrequest received response return=$rc" | ||||
|  logger -t $log_label -p local4.info "xcatserver:xcatflowrequest received response return=$rc" | ||||
|  if [ $rc -ne 0 ]; then | ||||
|     logger -t xcat -p local4.info "xcatserver: error from xcatflowrequest, will not use flow control" | ||||
|     logger -t $log_label -p local4.info "xcatserver: error from xcatflowrequest, will not use flow control" | ||||
|     useflowcontrol=0 | ||||
|  fi | ||||
|  | ||||
| @@ -127,7 +132,7 @@ getcredentials.awk xcat_cfgloc | grep -v '<'|sed -e 's/</</' -e 's/>/>/' - | ||||
| grep -E '<error>' /etc/xcat/cfgloc | ||||
| if [ $? -ne 0 ]; then | ||||
|         #the message received is the data | ||||
|    logger -t xcat -p local4.info "xcatserver: getting cfgloc" | ||||
|    logger -t $log_label -p local4.info "xcatserver: getting cfgloc" | ||||
|     MAX_RETRIES=10 | ||||
|     RETRY=0 | ||||
|     MYCONT=`cat /etc/xcat/cfgloc` | ||||
| @@ -147,12 +152,12 @@ if [ $? -ne 0 ]; then | ||||
|       fi | ||||
|       if [ $useflowcontrol = "1" ]; then | ||||
|          #first contact daemon  xcatflowrequest <server> 3001 | ||||
|          logger -t xcat -p local4.info "xcatserver: sending xcatflowrequest $master 3001" | ||||
|          logger -t $log_label -p local4.info "xcatserver: sending xcatflowrequest $master 3001" | ||||
|          /$xcatpost/xcatflowrequest $master 3001 | ||||
|          rc=$? | ||||
|          logger -t xcat -p local4.info "xcatserver:xcatflowrequest return=$rc" | ||||
|          logger -t $log_label -p local4.info "xcatserver:xcatflowrequest return=$rc" | ||||
|          if [ $rc -ne 0 ]; then | ||||
|            logger -t xcat -p local4.info "xcatserver: error from xcatflowrequest, will not use flow control" | ||||
|            logger -t $log_label -p local4.info "xcatserver: error from xcatflowrequest, will not use flow control" | ||||
|            useflowcontrol=0 | ||||
|          fi | ||||
|       fi | ||||
| @@ -178,7 +183,7 @@ if [ $? -ne 0 ]; then | ||||
| else  # error from first getcredentials call | ||||
|         #the message received is an error from credentials.pm, so parse it | ||||
|         ERR_MSG=`sed -n 's%.*<error>\(.*\)</error>.*%\1%p' /etc/xcat/cfgloc` | ||||
|         logger -t xcat -p local4.err xcatserver: $ERR_MSG | ||||
|         logger -t $log_label -p local4.err xcatserver: $ERR_MSG | ||||
|         rm /etc/xcat/cfgloc | ||||
| fi | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user