wcj75019 has asked for the wisdom of the Perl Monks concerning the following question:
It is kind of a mess now. Thanks!'bgs') /sbin/sh /usr/adm/best1_default/bgs/scripts/best1agent_start >>\$LOG + 2>>\$LOG ;;
#!/usr/bin/perl -w use strict; my $CF_bgs = "watch process procAlive 'bgs' 8 0x2 60 'Productio +n Critical: bgs failure. Restarting bgs''/opt/EMPsysedge/bin/sysedge +.sh'"; my $bgs=<<HERE; 'bgs') /sbin/sh /usr/adm/best1_default/bgs/scripts/best1agent_start >>\$LOG + 2>>\$LOG ;; HERE #my $BestAgent = "/sbin/sh /usr/adm/best1_default/bgs/scripts/best1age +nt_start>>\$LOG 2>>\$LOG"; #my $BestCollect = "/usr/bin/su - patrol /usr/adm/best1_default/bgs/sc +ripts/best1collect -q>>\$LOG 2>>\$LOG"; open CF_FILES, "cf.files" or die "$!"; open SH_FILES, "sh.files" or die "$!"; my @cf_files=<CF_FILES>; my @sh_files=<SH_FILES>; close CF_FILES; close SH_FILES; my @CF_L = grep(/bgs/, @cf_files); foreach my $cf(@cf_files){ chomp $cf; my $cf_temp = "$cf".".sysedge"; open F, "$cf"; my @F_cf = <F>; # my @CF_L = grep("bgs", @F_cf); open(TMP, ">/tmp/$cf_temp"); my $line; while($line = <F>){ if($line =~ m#'bgs'#){ print $line; $line = "$CF_bgs\n"; #my $newline = $. + 1; print $line; } elsif ( $line =~ m#'syslogd'# ){ my $newline = $. + 1; $newline = $CF_bgs; print TMP "$newline\n"; } print TMP $line; } close TMP; close F; } #print @CF_L; #print @cf_files; #rename("out.$test", $test);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Logic Question
by apl (Monsignor) on Feb 21, 2008 at 20:13 UTC | |
|
Re: Logic Question
by toolic (Bishop) on Feb 21, 2008 at 20:12 UTC | |
|
Re: Logic Question
by hipowls (Curate) on Feb 21, 2008 at 20:14 UTC | |
|
Re: Logic Question
by ysth (Canon) on Feb 21, 2008 at 23:21 UTC | |
by wcj75019 (Acolyte) on Feb 22, 2008 at 23:41 UTC | |
by ysth (Canon) on Feb 22, 2008 at 23:44 UTC | |
by wcj75019 (Acolyte) on Feb 23, 2008 at 00:56 UTC | |
|
Re: Logic Question
by moklevat (Priest) on Feb 21, 2008 at 21:38 UTC |