how to have gawk receive user signals?



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
.



Relevant Pages

  • Re: Why is awk performing well in efficiency
    ... The Gawk script beat your C program even though your C program solves ... the hard work into optimizing your C program that went into optimizing the awk ... Performance comes from good algorithms and larger scale program organization. ...
    (comp.lang.awk)
  • randomizing trouble
    ... I have a gawk script that puts random comments into a file. ... I found that seeding the random number generator using gawk did not work because all 3 times it was run was done within the same second - so I decided to use bash's random number generator to do it which seems to work, but I still find that almost every time I run the script I find that a line appears twice in a row and almost every time a line within the file will be the same as a line within one of the other 2 files. ... # used for srand as srandmakes the same random number each time since ...
    (comp.lang.awk)
  • Re: how to have gawk receive user signals?
    ... You can have a shell script respond to signals, ... to tell a gawk script to restart after logrotate does its thing ...
    (comp.lang.awk)
  • Re: Bash gawk problem
    ... variables withing the gawk script do not use the $-character ... According to a command line ...
    (comp.unix.shell)
  • Re: Bit Twister: Is this the dhclient-exit-hooks you were talking about?
    ... If you are running the dhclient then all you have to do is ... create the hooks script with YOUR CODE. ... DNS server with my wgets and then restart my firewall. ... You can put an echo statement on commands to show you what will happen ...
    (alt.os.linux)