Re: how to have gawk receive user signals?



There is no way to do this (without hacking on the source code).

You can have a shell script respond to signals, so it may be easiest
to wrap your awk script in a shell program to manage the signal
handling.

Thanks,

Arnold

Hmmmm... This might be doable as a loadable module. There are memory
management issues to deal with, though.

In article <18hii5l1chtuvjv0n4htdb39famm3nu6g9@xxxxxxx>,
Grant <g_r_a_n_t_@xxxxxxxxxxxxxxxxx> wrote:
Hi there,

Is there a way to have gawk respond to a user signal? I'd like
to tell a gawk script to restart after logrotate does its thing
and pulls a logfile out from under a log pretty-printer script.

The gawk script is evoked by:

# tail -f /var/log/messages | sf4sf -f /etc/sf4sf.conf

And, in the main loop, there's:
...
########################### start main program ##############################

!initialised { initialise(); ++initialised }

# read database files
...

So all I need to restart script is set 'initialised' to zero in
response to a user signal, perhaps -HUP?

My reading of the gawk info doesn't tell much about what signal
handling is available to the running script.

I'm using gawk-3.1.7 on Slackware-11.

[0] http://bugsplatter.id.au/firewall/sf4sf.txt for the curious ;)

Grant.
--
http://bugsplatter.id.au
--
Aharon (Arnold) Robbins arnold AT skeeve DOT com
P.O. Box 354 Home Phone: +972 8 979-0381
Nof Ayalon Cell Phone: +972 50 729-7545
D.N. Shimshon 99785 ISRAEL
.



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)
  • Re: deadlocks with intr NFS mounts and ^Z (or: PCATCH and sleepable locks)
    ... Script started on Sat Jun 20 02:32:51 2009 ... The shell script zm builds 6 kernels in parallel using make -k -j8 for ... Anyway, the messages about signals ...
    (freebsd-arch)
  • 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)