#!/usr/bin/perl -w
use strict;
my @ServicesOnMachine = qw(NetworkManager acpid anacron atd auditd aut
+ofs avahi-daemon avahi-dnsconfd bluetooth capi conman cpuspeed crond
+cups dnsmasq dund firstboot gpm haldaemon hidd hplip httpd ip6tables
+iptables irda irqbalance iscsi iscsid isdn kudzu lvm2-monitor mcstran
+s mdmonitor mdmpd messagebus multipathd netconsole netfs netplugd net
+work nfs nfslock nscd ntpd oddjobd pand pcscd portmap psacct rawdevic
+es rdisc readahead_early readahead_later restorecond rpcgssd rpcidmap
+d rpcsvcgssd saslauthd sendmail smartd sshd svnserve syslog tcsd vbox
+add vboxadd-service vboxadd-x11 vncserver wdaemon winbind wpa_supplic
+ant xfs ypbind yum-updatesd);
my @ServiceCheckList = ("spray", "echo", "daytime", "discard", "charge
+n", "ttdb", "ypbind", "ypserv", "yppasswdd", "ypxfrd", "tooltalk", "r
+statd", "comsat", "talk", "uucp", "finger", "netstat", "systat", "rus
+ers", "walld", "rexd", "rje", "netbios", "lpd", "http", "gopher", "tc
+pmux", "news", "nntp", "snmp", "mail", "smtp", "pop2", "pop3", "sendm
+ail", "httpd");
foreach my $service (@ServiceCheckList) {
if (grep($service, @ServicesOnMachine)) {
print "$service matches\n";
}
}
Correction
foreach my $service (@ServiceCheckList) {
if (grep(/^$service$/, @ServicesOnMachine)) {
print "$service matches\n";
}
}
Thanks!
|