(imported topic written by VipulSri)
Hello,
I am trying to convert my Shell script to Bigfix action script using the tool from
http://bigfix.me/content/shelltoaction
It doesn’t work as the output fails, however if I push my shell script choosing the “sh” option under Action Script tab it works fine.
I am able to push the information properly but to get it as an action script would be better so that it can be shared with everyone.
Shell Script:
#!/bin/bash
rm /var/opt/BESClient/__BESData/"BES Inventory and License"/__HardwareInfo/inventory.txt
rm /var/opt/BESClient/__BESData/"BES Inventory and License"/__HardwareInfo/application.txt
#OS Serial Number (Prior to getting this information, you need to have "sneep" installed on the Solaris Endpoint)
echo "SerialNumber:`sneep`" >> /var/opt/BESClient/__BESData/"BES Inventory and License"/__HardwareInfo/inventory.txt
#Processor Core Count
echo "Processor_Core_Count:`kstat -m cpu_info|grep -w core_id|uniq|wc -l`" >> /var/opt/BESClient/__BESData/"BES Inventory and License"/__HardwareInfo/inventory.txt
#Number of Physical Processor(s)
echo "Number_of_Physical_Processor(s):`psrinfo -p`" >> /var/opt/BESClient/__BESData/"BES Inventory and License"/__HardwareInfo/inventory.txt
#Number of Virtual Processor(s)
echo "Number_of_Virtual_Processor(s):`psrinfo|wc -l`" >> /var/opt/BESClient/__BESData/"BES Inventory and License"/__HardwareInfo/inventory.txt
#Processor Total Count
virtual=`psrinfo|wc -l`
physical=`psrinfo -p`
echo "Processor_Total_Count:$(( $virtual + $physical ))" >> /var/opt/BESClient/__BESData/"BES Inventory and License"/__HardwareInfo/inventory.txt
#Owner * (Last Logon)
echo "last_loggedon_user:`last | head -1 | awk '{ print $1 }'`" >> /var/opt/BESClient/__BESData/"BES Inventory and License"/__HardwareInfo/inventory.txt
#HDD Total Count
echo "HDD_Total_Count:`format </dev/null | grep -c '[0-100]\.'`" >> /var/opt/BESClient/__BESData/"BES Inventory and License"/__HardwareInfo/inventory.txt
#Application
pkginfo -l | /usr/xpg4/bin/grep -e 'NAME' -e 'VENDOR' -e 'VERSION' >> /var/opt/BESClient/__BESData/"BES Inventory and License"/__HardwareInfo/application.txt
#Physical / Virtual
prtdiag -v | grep -i "System Configuration" | egrep -i '(VMware)|(Virtual)'
if [[ $? -eq 0 ]]
then
echo "Virtual/Physical:virtual machine" >> /var/opt/BESClient/__BESData/"BES Inventory and License"/__HardwareInfo/inventory.txt
else
echo "Virtual/Physical:physical machine" >> /var/opt/BESClient/__BESData/"BES Inventory and License"/__HardwareInfo/inventory.txt
fi
Any help?
Thanks
Vipul