Re:signal processing INT or TERM




Message du 30/10/08 10:45
De : "icarus"
A : beginners@xxxxxxxx
Copie à :
Objet : signal processing INT or TERM


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?




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://home.arcor.de/pangj/

Créez votre adresse électronique prenom.nom@xxxxxxxxxxx
1 Go d'espace de stockage, anti-spam et anti-virus intégrés.


Relevant Pages

  • Re: OpenVMS 8.1 ships
    ... Perl has about ... only modifications to one DCL script and one Perl script ... signals with a home-grown implementation based on the undocumented ... CRTL bug on 7.x systems that precludes the ability to call ...
    (comp.os.vms)
  • How to propagate signal down to child? trap erratic; wait not waiting
    ... I am having trouble propagating signals down to a child. ... I have a script s.sh that calls a program p ... trap killchild SIGTERM ...
    (comp.unix.shell)
  • Re: logrotate error
    ... logrotate -bash-3.00# logrotate -f logrotate.conf error: ... running script with arg /var/log/servicelog: " /bin/killall -s HUP ntpd; ... If you have not used strace before, its output is voluminous enouhg to bring ... to see what they do when they receive signals. ...
    (comp.os.linux.setup)
  • Re: Ctrl-C in script causing started process to terminate
    ... I ran the script and waited a bit for my process to finish its ... SIGINT and 2 of the child processes just die at the same time. ... disposition for signals handled in the parent is set to SIG_DFL. ... pressing C-C) are sent to the foreground process group, ...
    (comp.unix.programmer)
  • Re: Disabling/Enabling Keys in BASH Script
    ... > and when you use it, at any point of executing the script. ... the terminal sends a SIGINT ... signal to the foreground process group of processes (the shell ... You can tell the terminal to stop sending signals upon pressing ...
    (comp.unix.shell)