signal processing INT or TERM

PERL

    Next

  • 1. Directory sizes
    Hi list, Maybe someone can help me with this, I have two strange directory size calculating issues: I do a my ( $rc2, $backupsizetrans ) = rexec( $backuphost, 'du -k ' . "$backupdir\/$backdir2" . ' |tail -1 |awk \'{ print $1 }\'' ); to get the size of a certain directory from another machine. In my test case, this results to 72KB. But if I check manually on the host via a local oracle:/backup>du -k MVSTADB_9.9.99.99_100504-112005 I get 68 KB size as a result. What's even more interesting, the du (Filesys::DiskUsage) says the directory has a local size of 69539 Bytes which, divided by 1024, results to 67.9091... . So I guess this all is some rounding issue!? If so, I would appreciate any hints how to best compare the sizes of two directories - one on the local machine, the other one via rexec - as exact as possible. Thanks in advance, Nora
  • 2. about substr
    On Sat, 28 Nov 2037 10:04:37 +0800, billy wrote: > when i user substr,i find "Tab" key is calculated as 1,but i want to set > it as 8,what will i do? thks. Tab doesn't mean a fixed space between the content before and after it on a line. If you want that, use spaces instead. -- Petr
  • 3. Perl modules to process PDF files
    Hi All, I need to process some PDF files to do some complex validation (like checking the colour of icons, position etc). I was wondering if Perl comes with some handy modules to process PDF files? AFAIK even professional tools like QTP are not good with processing PDF files. Cheers, Parag
  • 4. testing if divisible by?
    Hello all. How can I test to see if a number is divisible by say, 40? Thanks.

signal processing INT or TERM

Postby rsarpi » Fri, 31 Oct 2008 05:50:54 GMT

perl 5.8.2
OS: AIX fully POSIX compliant

my script moves files from one dir to another.
When I want my script to stop, should I pass it along the signal INT
or TERM?

INT just interrupts the script.  It finishes whatever it's processing
and then it's done.

TERM on the other hand, just sends a TERMination signal, waits a few
seconds, then KILLs the program.  TERM is more common I guess when
starting/stopping unix shell scripts in the init dir.

My fear is that if I pass the TERM signal, maybe the system will chop
off the files that are being moved on the fly.  The "few seconds" are
unpredictable in value at least on my system. So the system might say
'it's been too long, let's kill it."

Any thoughts? Is there a "perlish" way to do it?





Re:signal processing INT or TERM

Postby pangj » Fri, 31 Oct 2008 23:20:37 GMT



 > Message du 30/10/08 10:45



SIGTERM and SIGINT are almost the same usage. See 'man 8 kill' and look for signals.
You may want to redefine the POSIX signal handlers.
See also L. Stein's "Network programming with Perl", that will give the full details.


Jeff.
 http://www.**--****.com/ 

 Crez votre adresse lectronique  XXXX@XXXXX.COM  
 1 Go d'espace de stockage, anti-spam et anti-virus intgrs.


Re: signal processing INT or TERM

Postby carnildo » Sun, 02 Nov 2008 05:22:20 GMT



I'd send a custom signal (say, USR1).  When the script receives that
signal, it sets a flag indicating it should perform a clean exit.
Totally untested:

----------
my $done = 0;

sub sigusr {
    $done = 1;
}

$SIG{USR1} = \&sigusr;

while(!$done)
{
    # Do something
}
# Clean up and exit
----------

It won't work if "do something" is perpetually blocked on a read or
somesuch, but if you wake up periodically to go through the loop,
you'll be fine.

-- 
Mark Wagner

Similar Threads:

1.Signal Handling/Term::ReadLine problem in Perl

2.KILL INT can not wake up $SIG{INT}

Hi list,

Anyone has such experience? KILL INT pid cannot wake up $SIG{INT}  sub{}.

my code is like;

$SIG{INT} = sub {#load pm}

$SIG{ALRM} = sub {print "Driver $pm is going to sleep... bye.\n"; exit;};

the pm actually has a system call to execute something
sub xxx {
`perl xxx.pl` 
}

but  

my $tmp = kill "INT", $pid; ## it returns number of processes, eg: 1
cannot wake up the $SIG{INT}  at all after $SIG{ALRM} has been executed.

does system call cause the problem?

Thanks.

3.(fwd) Toplevel doesn't update (signals not processed in MainLoop)

> I suspect this is part of Perl's safe signal handling - the *operating
> system* signal isn't being delivered because perl isn't doing anything.
> Once you wave the cursor over a window an *X11 signal* is raised and
> the Tk event loop restarts.
> So, one way to have an alien process alert an idle Tk program is to
> never have it idle - i.e. keep the event loop active.
> 
> So, alien process does "kill USR2, ptk-process", and ptk-process does:
> 
>      $SIG{USR2} = sub { &synchronize };
>      $mw->repeat( 10_000 => sub { $mw->idletasks } );



Yes, I read about the safe signal handling in Perl. But I  think this 
behaviour of Tk isn't OK, it should be considered as a bug or unwanted 
feature. IMO there is no reason for not handling signals imediately, while 
being idle in the MainLoop.
Keeping the MainLoop active isn't an option for my program.
I read the "Tk + perl-5.8.0 eat and delays signals"-thread on the same 
newsgroup, where someone suggests using the old signal-handler-stuff via 
the POSIX module and sigaction...

1) Maybe someone can check if the MainLoop / Signal problem can be improved?

2) I should find a better design for my process communication
        (and will start a new thread for that ;-)


Hannes

4.process signals

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?


Derek B. Smith
OhioHealth IT
UNIX Support

5.Call For Manuscripts: International Journal of Signal Processing (IJSP)

Call For Manuscripts
The International Journal of Signal Processing (IJSP) is currently
accepting original high-quality research manuscripts for publication.
The Journal welcomes the submission of manuscripts that meet the
scientific criteria of significance and academic excellence. All
research articles submitted for the journal will be peer-reviewed
within three weeks of submission. Following the peer-reviewed
acceptance, the accepted & formatted articles will normally be
published in the next available issue.

All submitted formatted full-text articles should report original,
previously unpublished research results, experimental or theoretical.
Articles submitted to the journal should meet these criteria and must
not be under consideration for publication elsewhere. These articles
should describe new and carefully confirmed findings, and experimental
procedures should be given in sufficient detail for others to verify
the work. The length of a full text article should be the minimum
required to describe and interpret the work clearly.

Papers are solicited from, but not limited to the following topics:

    * Adaptive Filtering & Signal Processing
    * Ad-Hoc and Sensor Networks
    * Analog and Mixed Signal Processing
    * Array Signal Processing
    * Audio and Electroacoustics
    * Audio/Speech Processing and Coding
    * Bioimaging and Signal Processing
    * Biometrics & Authentification
    * Biosignal Processing & Understanding
    * Communication and Broadband Networks
    * Communication Signal processing
    * Computer Vision & Virtual Reality
    * Cryptography and Network Security
    * Design and Implementation of Signal Processing Systems
    * Digital Signal Processing
    * DSP Implementations and Embedded Systems
    * Emerging Technologies
    * Hardware Implementation for Signal Processing
    * Higher Order Spectral Analysis
    * Image and Multidimensional Signal Processing
    * Image Processing & Understanding
    * Image/Video Processing and Coding
    * Industry Technology
    * Internet Signal Processing
    * Machine Learning for Signal Processing
    * Modulation and Channel Coding
    * Multimedia & Human-computer Interaction
    * Multimedia Communications
    * Multimedia Signal Processing
    * Natural Language Processing
    * Next Generation Mobile Communications
    * Nonlinear Signal Processing
    * Optical Communications
    * Parallel and Distributed Processing
    * PDE for Image Processing
    * Radar Signal Processing
    * Rapid Prototyping and Tools for DSP Design
    * RF and Wireless Communications
    * Sensor Array and Multi-channel Processing
    * Signal Processing and Communications Education
    * Signal Processing for Communications
    * Signal Processing for Security
    * Signal Processing Theory and Methods
    * Soft Computing and Machine learning for Signal Processing and
Communications
    * Sonar Signal Processing and Localization
    * SP for Bioinformatics
    * SP for Biomedical & Cognitive Science
    * SP for Internet and Wireless Communications
    * SP for Sensor Networks
    * Spectrum Estimation & Modeling
    * Speech and Audio Coding
    * Speech Processing
    * Speech Synthesis & Recognition
    * Spoken Language Processing
    * Statistic Learning & Pattern Recognition
    * Statistical Signal Processing
    * TF Spectrum Analysis & Wavelet
    * Time-Frequency/Time-Scale Analysis
    * Video compression & Streaming
    * Watermarking and Information Hiding
    * Applications of Signal Processing (Biomedical, Bioinformatics,
Genomic, Seismic, Radar, Sonar, Remote Sensing, Positioning, Embedded
Systems, etc.)
    * Signal Processing and Communications Education
    * Web Engineering
    * Wireless Communications
    * Detection and Estimation
    * Cooperative Communication
    * Adaptive and Array Signal Processing
    * MIMO and Space-Time Signal Processing
    * Compressive Sensing & Applications
    * Cognitive Radio
    * Signal Processing for Communications
    * Network Coding
    * Machine Learning/AI for Signal Processing
    * Network Information Theory
    * Audio, Speech, Image & Video Signal Processing
    * Sequences & Complexity
    * Signal Processing Algorithms & Architectures
    * Source and Channel Coding: Theory and Practice
    * Underwater Communications and Signal Processing
    * Ad-hoc and Sensor Networks
    * Optical Communications and Networks
    * Next Generation Networking, QoS & Security
    * VLSI for Communication & Signal Processing
    * Multihop and Mesh Networks
    * RF Systems for Communications
    * Vehicular Networks
    * Systems, Standards and Implementations
    * Biomedical Signal Processing
    * Coding/Signal Processing in Biology
    * Spoken Language Processing
    * Biological Network & Data Analysis/Modelling


CALL FOR PAPERS
International Journal of Signal Processing (IJSP)
Website: https://sites.google.com/site/ijsporg/
IMPORTANT DATES:
Paper Submission Deadline: March 5, 2010
Notification of Acceptance: March 30, 2010
Publication Date: April 15, 2010
Manuscript submission to:  XXXX@XXXXX.COM 
All submitted papers will be judged based on their quality by the
technical committee and reviewers. Papers that describe research and
experimentation are encouraged. All paper submissions will be handled
electronically and detailed instructions on submission procedure are
available on IJSP web pages. Researchers and authors are invited to
participate in the peer-review process of IJSP papers if your research
interest matches with the themes of Call for Papers. For other
information, please contact IJSP Managing Editor.

6. Questions about perl daemons with child processes and open files / signals

7. Call For Manuscripts: International Journal of Signal Processing (IJSP)

8. Term::Clui in modlist/User_Interfaces/Term ?



Return to PERL

 

Who is online

Users browsing this forum: No registered users and 69 guest