(imported topic written by Darknight)
Hi All,
i have prepared a shell script and executing it on hp-ux endpoint through task:
#!/sbin/sh
mkdir -p "/var/opt/BESClient/__BESData/actionsite/__HardwareInfo/"
rm /var/opt/BESClient/__BESData/actionsite/__HardwareInfo/inventory.txt
echo "Machine Serial Number:`getconf MACHINE_SERIAL`" >> /var/opt/BESClient/__BESData/actionsite/__HardwareInfo/inventory.txt
echo "CPU_CHIP_TYPE:`getconf CPU_CHIP_TYPE`" >> /var/opt/BESClient/__BESData/actionsite/__HardwareInfo/inventory.txt
echo "CPU VERSION:`getconf CPU_VERSION`" >> /var/opt/BESClient/__BESData/actionsite/__HardwareInfo/inventory.txt
echo "HW_CPU_SUPP_BITS:`getconf HW_CPU_SUPP_BITS`" >> /var/opt/BESClient/__BESData/actionsite/__HardwareInfo/inventory.txt
echo "logical processor:`print_manifest | perl -nle '/(\d+) logical processors/&&($x=$1);END{print "$x"}'`" >> /var/opt/BESClient/__BESData/actionsite/__HardwareInfo/inventory.txt
echo "cores:`print_manifest | awk '/([[:digit:]]+[[:space:]])(core|cores)([[:space:]]+$|$|,)/{gsub(/,/,x);print $1}'| tail -1`" >> /var/opt/BESClient/__BESData/actionsite/__HardwareInfo/inventory.txt
if i run the script manually on server its giving below output which is expected out of it :
cat /var/opt/BESClient/__BESData/actionsite/__HardwareInfo/inventory.txt
Machine Serial Number:VM01328001
CPU_CHIP_TYPE:553649156
CPU VERSION:768
HW_CPU_SUPP_BITS:64
logical processor:16
cores:1
but whenever i try to include this script in task and run it as shell script it provides output as below :
cat /var/opt/BESClient/__BESData/actionsite/__HardwareInfo/inventory.txt
Machine Serial Number:VM01328001
CPU_CHIP_TYPE:553649156
CPU VERSION:768
HW_CPU_SUPP_BITS:64
logical processor:
cores:
Can someone help me in understanding why this is happening . Do i have to make any changes in my script and then run it via IEM.
Also additionally i can see the below highlighted text in pink colour on IEM console whenever i try to inlcude it in action script:
echo “logical processor:print_manifest | perl -nle '/(\d+) logical processors/&&($x=$1);END {print "$x"} '
” >> /var/opt/BESClient/__BESData/actionsite/__HardwareInfo/inventory.txt
echo “cores:print_manifest | awk '/([[:digit:]]+[[:space:]])(core|cores)([[:space:]]+$|$|,)/ {gsub(/,/,x);print $1} '| tail -1
” >> /var/opt/BESClient/__BESData/actionsite/__HardwareInfo/inventory.txt
i have also tried to run the above shell script as bigfix action script but results are same,below is the action script :
wait mkdir -p “__HardwareInfo/”
delete __appendfile
appendfile #!/sbin/sh
appendfile mkdir -p “/var/opt/BESClient/__BESData/actionsite/__HardwareInfo/”
appendfile rm /var/opt/BESClient/__BESData/actionsite/__HardwareInfo/inventory.txt
appendfile echo “Machine Serial Number:getconf MACHINE_SERIAL
” >> /var/opt/BESClient/__BESData/actionsite/__HardwareInfo/inventory.txt
appendfile echo “CPU_CHIP_TYPE:getconf CPU_CHIP_TYPE
” >> /var/opt/BESClient/__BESData/actionsite/__HardwareInfo/inventory.txt
appendfile echo “CPU VERSION:getconf CPU_VERSION
” >> /var/opt/BESClient/__BESData/actionsite/__HardwareInfo/inventory.txt
appendfile echo “HW_CPU_SUPP_BITS:getconf HW_CPU_SUPP_BITS
” >> /var/opt/BESClient/__BESData/actionsite/__HardwareInfo/inventory.txt
appendfile echo “logical processor:print_manifest | perl -nle '/(\d+) logical processors/&&($x=$1);END{{print "$x"}'
” >> /var/opt/BESClient/__BESData/actionsite/__HardwareInfo/inventory.txt
appendfile echo “cores:print_manifest | awk '/([[:digit:]]+[[:space:]])(core|cores)([[:space:]]+$|$|,)/{{gsub(/,/,x);print $1}'| tail -1
” >> /var/opt/BESClient/__BESData/actionsite/__HardwareInfo/inventory.txt
delete inventory.sh
copy __appendfile inventory.sh
wait chmod 555 inventory.sh
wait sh inventory.sh