forked from epety/100-shell-script-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
051-enabled.sh
executable file
·36 lines (29 loc) · 873 Bytes
/
051-enabled.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/sh
# enabled - show what services are enabled with inetd and xinetd,
# if they're available on the system.
iconf="/etc/inetd.conf"
xconf="/etc/xinetd.conf"
xdir="/etc/xinetd.d"
if [ -r $iconf ] ; then
echo "Services enabled in $iconf are:"
grep -v '^#' $iconf | awk '{print " " $1}'
echo ""
if [ "$(ps -aux | grep inetd | egrep -vE '(xinet|grep)')" = "" ] ; then
echo "** warning: inetd does not appear to be running"
fi
fi
if [ -r $xconf ] ; then
# don't need to look in xinietd.conf, just know it exists
echo "Services enabled in $xdir are:"
for service in $xdir/*
do
if ! $(grep disable $service | grep 'yes' > /dev/null) ; then
echo -n " "
basename $service
fi
done
if ! $(ps -aux | grep xinetd | grep -v 'grep' > /dev/null) ; then
echo "** warning: xinetd does not appear to be running"
fi
fi
exit 0