I am new to HP-UX and never worked on Ksh/Csh. Have been working with bash on Linux for quite some time now. I have below few code snippets to extract system information from Linux centos and dump to a CSV as output.
Would appreciate if someone can help me with equivalent command/output on HP-UX as none of these works on HP-UX.
1) To output all installed packages and version on Linux Centos:
rpm -qa --qf "%{name},%{version}\n" > $HOME/MyLog/installed_packages_.csv
2) To output all running processes, PID and memory on Linux Centos:
top -b -n 1 | awk 'NR>7 {print date","ip","$12,","$1,","$10}' >> $HOME/MyLog/running_process.csv
3) To output all running services, package name and status on Linux Centos:
for i in `chkconfig --list | awk '{ print $1}'`; do
status=`/sbin/service $i status`
packagename=`rpm -qf /etc/init.d/$i`
if echo "$status" |grep -q running; then
echo $tdydate","$ip","$i","$packagename",""Running" >> "$HOME/MyLog/running_services_${ip}_${tdaydatefile}.csv"
else
if echo "$status" |grep -q stopped; then
echo $tdydate","$ip","$i","$packagename",""Stopped" >> "$HOME/MyLog/running_services_${ip}_${tdaydatefile}.csv"
fi
fi
done
I am looking for an equivalent of the above scripts on HP-UX. Any help here would be appreciated.