RE: Signal Handling

From: Mahtaj Khamneian (khamneianm_at_umsystem.edu)
Date: 12/16/03


Date: Tue, 16 Dec 2003 14:46:20 -0600
To: "Helck, Timothy" <Timothy.Helck@bowker.com>,	<dbi-users@perl.org>

Both the SELECT in the database and the perl process continue to run after CTRL-C.
I have to do a "kill pid" from the shell to stop the execution in both places. Same results after I tried what you have suggested below.
 I have no problem implementing signal handling in non-DBI perl.
Have you been able to interrupt processing using your method? Are you using Oracle?

Thanks,
-MK
 
> -----Original Message-----
> From: Helck, Timothy [mailto:Timothy.Helck@bowker.com]
> Sent: Tuesday, December 16, 2003 1:04 PM
> To: Khamneian, Mahtaj; dbi-users@perl.org
> Subject: RE: Signal Handling
>
>
> I'm not able to reproduce your results.
>
> Does ctrl-C kill the perl process and leave the select
> running, or does it fail to kill the perl?
>
> Does ctrl-C work if you change any of the following?
> remove sleep()
> remove distinct from the query
> replace dump_results() with bind_columns() and fetch()
>
>
> -----Original Message-----
> From: Khamneian, Mahtaj [mailto:khamneianm@umsystem.edu]
> Sent: Tuesday, December 16, 2003 11:36 AM
> To: dbi-users@perl.org
> Subject: RE: Signal Handling
>
>
> Thanks for the reply.
> I have tried a slight variation of what you've suggested, but
> it seems, the db operation is not cancelled as a result of hitting
> CTRL-C-- I have to kill the process manually to stop the program.
> Here's a snippet of the program:
> ...
> sub kill_me{my $key = shift; die "\n\n\tKilled:$key\n\n";}
> $SIG{INT} = \&kill_me;
>
> DBI->trace (0);
>
> # connect to target db
> my $dbh = DBI->connect ("dbi:Oracle:$sid", $user, $password)
> or die "Can't connect to database: $DBI::errstr\n";
>
> my $sth = $dbh->prepare( "select distinct sid, status,
> client_info, b.name, b.emailid from
> v\$session, ps_um_employees b where
> substr(client_info,1,(instr(client_info,',')-1))=b.mang
> led_sso (+) and status='ACTIVE'" );
>
> while (1) {
> $sth->execute();
> my $rows = $sth->dump_results();
>
> sleep(5);
> }
>
> $dbh->disconnect;
>
> exit 0;
>
>
> > -----Original Message-----
> > From: Helck, Timothy [mailto:Timothy.Helck@bowker.com]
> > Sent: Tuesday, December 16, 2003 7:51 AM
> > To: Khamneian, Mahtaj; dbi-users@perl.org
> > Subject: RE: Signal Handling
> >
> >
> > I'm not sure if this is what you have in mind:
> >
> > sub kill_me{my $key = shift; die "\n\n\tKilled:$key\n\n";}
> > $SIG{INT} = \&kill_me;
> >
> > This will kill the Perl process and (I think) any child processes.
> >
> >
> > -----Original Message-----
> > From: Khamneian, Mahtaj [mailto:khamneianm@umsystem.edu]
> > Sent: Monday, December 15, 2003 4:17 PM
> > To: dbi-users@perl.org
> > Subject: Signal Handling
> >
> >
> > Has anyone been able to successfully implement CTRL-C signal
> > handling in Perl DBI?
> > If so, I'd appreciate an example.
> >
> > -------------------------------------
> > Mahtaj Khamneian
> > University of Missouri - ASP Phone : (573) 884-2281
> > 1805 East Walnut Fax : (573)
> > 884-3070
> > Columbia, MO 65201-6425 khamneianm@missouri.edu
> > I wish I were able to create a program that could ping my mind.
> > I would then load it into the creation's/nature's server, for which
> > no root access is needed, and invoke it via cron at spontaneous
> > intervals.
> >
> >
>



Relevant Pages

  • RE: Signal Handling
    ... Does ctrl-C kill the perl process and leave the select running, or does it fail to kill the perl? ... > Subject: Signal Handling ...
    (perl.dbi.users)
  • Re: I Dont Have Enough Faith to Be a Christian
    ... In perl, it's probably executable. ... kill spiders, pop them, chop, split, kill them. ... unlink arms, shift, wait & listen (listening, wait), ... die to reverse the system ...
    (uk.rec.sheds)
  • Re: Help on perl alarm
    ... You have a Perl process that's ... shelling out to another Perl process, that in turn is shelling out to ... You then store up a shell command line in $cmd. ... the shell to spawn a child perl process to execute your embedded code. ...
    (perl.beginners)
  • Re: kill process when file count reached,,.
    ... an infinite loop there, ... IMO you could just use readdir and grep in perl. ... You're using awk in backticks in a perl script? ... Perl has a kill builtin, why the hell not use that. ...
    (comp.lang.perl.modules)
  • Re: kill process when file count reached,,.
    ... I am trying to run a tcpdump and have perl kill the tcpdump once 10 ... This is perl, not a shell script. ... You're using awk in backticks in a perl script? ... Perl has a kill builtin, why the hell not use that. ...
    (comp.lang.perl.modules)