#!/bin/sh
#  wrapper script to run chkconfig with errors for the missing ones
# Copyright 2000 Philip Davies 

prog=`/bin/basename $0`
tmp=/tmp/$prog.$$
touch $tmp
error=""


## go to the overall dir and run the chkconfig for every script possible
# assumes sanity in terms of naming
cd /etc/rc.d/init.d
for i in *
	do
	/sbin/chkconfig --list $i >> $tmp 2>&1 || error="$error $i"
done

## now use sed to select the on cases and subs the off text for spaces 
echo " These are the processes turned on "
echo " ================================= "
echo " "
sed -n -e "/:on/ s/.:off//g;/:on/ p" $tmp 
echo "  "
rm -rf $tmp

## now deal with the ones that failed to chkconfig

echo " The following packages do not support chkconfig searching by hand"
echo " ================================================================="
echo " "
for i in $error
	do
	echo '>>>' $i
	find /etc/rc.d -name "S*${i}*" 
done

