in reply to Re: if or die!
in thread if or die!
#!/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 }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: if or die!
by shmem (Chancellor) on Mar 02, 2008 at 17:59 UTC | |
|
Re^3: if or die!
by ww (Archbishop) on Mar 02, 2008 at 18:06 UTC | |
by ack (Deacon) on Mar 03, 2008 at 05:00 UTC | |
by Anonymous Monk on Mar 03, 2008 at 07:42 UTC | |
|