In article
<[EMAIL PROTECTED]>, Rmck
wrote:
> Hi and Help,
>
> I have a perl script (A) that spawns a unix command and pipes that to a
> log file. Then at 23:59 I have a perl script (B) that kills script (A). At
> midnight script (A) is kicked off.
>
> My issue is my killing of srcipt (A) is not working. It either is showing
> under ps, but not doing anything or its still writing to the old log file,
> along with the new file.
>
> Are my perl scripts not correct?
That much is easy I think (no). :-) What I wonder is what result you got
with your debugging "print" line...
> Script(B):
> #!/bin/perl
>
> @snp = `pgrep snp.pl`;
> pop(@snp);
^^^ --Here you are throwing out what you just assigned aren't you?
> @snoop = `pgrep snoop`;
> push(@snp,@snoop);
> chomp(@snp);
--Chomp is to remove line returns, but you don't have any
How about:
my @to_kill = ("`pgrep snp.pl`", "`pgrep snoop`");
> foreach (@snp) {
> #print("Killing $_\n");
> `kill -9 $_`; --Shouldn't this be: system "kill -9 $_"; #??
> }
Whether this is the best way to do this someone else answered already I
think.
--
Kevin Pfeiffer
International University Bremen
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]