Bottom posted:

On Friday 07 May 2004 11:00 am, [EMAIL PROTECTED] wrote:
> yeah ok whatever....  I want to use perl not ksh...as simple as that.
>
> Derek B. Smith
> OhioHealth IT
> UNIX / TSM / EDM Teams
>
>
>
>
>
>
> "Jayakumar Rajagopal" <[EMAIL PROTECTED]>
> 05/07/2004 01:16 PM
>
>
>         To:     <[EMAIL PROTECTED]>, "Bob Showalter"
> <[EMAIL PROTECTED]> cc:     "Beginners Perl"
> <[EMAIL PROTECTED]>
>         Subject:        RE: process signals
>
>
> Mr Smith,
>         I saw your elementary question at about 8:50 AM. I did not 
answer
> it, since it was not clear to me too. I have seen Bob ( who I have never
> spoken with or by no means friend of me) answering good, difficult
> questions very legibly. If you think you have know better unix, then you
> may kindly let us know :
>       1) why were you not able to use unix system("kill..") command, 
than
> waiting for perl group to answer?
>       2) how you can print "\n" while 'command' has already been writing
> the log file. (in case 'command was in background')
>       3) don't you think you contradict either in (2) or in trying to
> signal the process that is already over before print "\n" (in case not 
in
> background)
>
> If you want to send singal hangup the process use : kill HUP => $PID
>
> with regards,
> Jay
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Friday, May 07, 2004 12:36 PM
> To: Bob Showalter
> Cc: Beginners Perl
> Subject: RE: process signals
>
>
> If you dont understand my question then I assume you do not know unix or
> tail -f ?  I want to after a sleep of 5-8 seconds, send a kill signal to
> the previous command then increment the counter.  thank you!
>
>
>
> Derek B. Smith
> OhioHealth IT
> UNIX / TSM / EDM Teams
>
>
>
>
>
>
> Bob Showalter <[EMAIL PROTECTED]>
> 05/07/2004 10:57 AM
>
>
>         To:     "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>,
> Beginners Perl
> <[EMAIL PROTECTED]>
>         cc:
>         Subject:        RE: process signals
>
> [EMAIL PROTECTED] wrote:
> > I have an application system command that is like tail -f in UNIX and
> > I want to say
> >
> > x=1
> > while x < 10
> > do
> >         'command'  append to log
> >         print "\n" append to log
> >         issue HANGUP or KILL SIGNAL
> >         x+=1
> > done
> >
> > How do I issue a hangup signal to this process using perl?
>
> I'm not sure I understand your problem, but the perl way to send a 
signal
> is
> with the kill() function. The way to catch a signal is by installing a
> handler using the %SIG hash.
>
> perldoc -f kill
> perldoc perlipc

Hi Mr.Smith,
       If you are more comfortable with shell scripting, and need to solve it urgently 
, you may write small sh script like this and call it from perl script:
 
        command &
        sleep 6
        kill -HUP $!
          echo "\n" >> log

with regards,
Jay


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to