#!/usr/bin/perl -w use strict; my $agent = "best1agent_start"; my $bgs=<<HERE; 'bgs') /usr/bin/su - patrol /usr/adm/best1_default/bgs/scripts/best1collect -q>>\$LOG 2>>\$LOG ;; HERE my $collect = " /usr/bin/su - patrol /usr/adm/best1_default/bgs/scripts/best1collect -q>>\$LOG 2>>\$LOG\n" +; my $cf_dir = "/root/sysedge/cf_files"; #my $cf_dir = "/export/home/f358118/sysedge"; open SH_FILES, "sys.sh" or die "Error: $!"; my @sh_f=<SH_FILES>; close SH_FILES; foreach my $sh (@sh_f) { local $/ = ''; # slurp mode open IN, '<', $sh # really? or is it "$cf_dir/$sh" ? or die "Can't open '$sh' for input: $!\n"; open OUT, '>', "$cf_dir/$sh.tmp" or die "Can't write '$cf_dir/$sh.tmp': $!\n"; $_ = <IN>; s/^\s*'bgs'\).*?;;//msg; s/^(\s*'syslogd'\).*?;;/$1\n$bgs/ms; print OUT; close OUT or die "Can't close filehandle OUT properly: $!\n"; rename "$cf_dir/$sh.tmp", $sh; # if appropriate }
In reply to Re^2: if or die!
by wcj75019
in thread if or die!
by wcj75019
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |