Hi,
I am trying to list down list of running services, corresponding package name and status on HP-UX box. The output will be a CSV in a fashion:- Service Name, Package Name, Status.
While working on Linux centos, I used chkconfig to do the same. Below was the snippet:-
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 $i","$packagename",""Running" > "$HOME/MyLog/running_services_${ip}_${tdaydatefile}.csv"
else
if echo "$status" |grep -q stopped; then
echo $i","$packagename",""Stopped" > "$HOME/MyLog/running_services_${ip}_${tdaydatefile}.csv"
fi
fi
done
Now, chkconfig doesn't exist on HP-UX. Is there a way I can retrieve the similar output on HP-UX? Any help related to this is appreciated.
Thanks.