#!/usr/bin/perl use strict; use warnings; use Getopt::Std; use Pod::Usage; use File::Find; my($appname) = @ARGV; getopts("hv", \my %opts); pod2usage() if $opts{h}; pod2usage("App name missing") unless defined $appname; find(sub { if($_ eq $appname or /^[KS]\d+$appname$/) { print "$File::Find::name\n"; } }, "/etc/rc.d"); __END__ =head1 NAME findrc - Find all /etc/rc.d files related to an application =head1 DOWNLOAD _SRC_HERE_ =head1 SYNOPSIS findrc appname (e.g. 'network') =head1 DESCRIPTION C traverses the files under /etc/rc.d and searches for all start/stop files related to an application. =head1 EXAMPLES # Find all network start/stop files $ findrc network /etc/rc.d/rc5.d/S10network /etc/rc.d/rc4.d/S10network /etc/rc.d/rc6.d/K90network /etc/rc.d/rc3.d/S10network /etc/rc.d/rc2.d/S10network /etc/rc.d/init.d/network /etc/rc.d/rc0.d/K90network /etc/rc.d/rc1.d/K90network # Delete them all # findrc network | xargs rm =head1 LEGALESE Copyright 2008 by Mike Schilli, all rights reserved. This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself. =head1 AUTHOR 2008, Mike Schilli