desired bahavior for "email" interactivity?

Nathan Stratton Treadway <[email protected]>
Newsgroups gmane.comp.archivers.amanda.devel
Message-ID <[email protected]>
(Looking at Amanda 3.4.3:)

I was experimenting with the "email" interactivity module, with the
following parameters (as found in the example/amanda.conf file):

    property "resend-delay" "10"
    property "check-file" "/tmp/email_input"
    property "check-file-delay" "10"

, and found the module's behavior a little confusing.

My testing was to run "amcheck" when there were no suitable volume
vtapes available... and then try to get amcheck to abort (by writing
"abort" to /tmp/email_input).

If /tmp/email_input doesn't exist when I start my "amcheck", then 
  * an email is generated every 10 seconds... until I create the
    email_input file
  * once I create the file, the emails stop, but Amanda doesn't 
    abort; checking with strace I see it continues to stat email_input
    every 10 seconds.  [see note]
  * if I then touch/modify email_input, Amanda aborts as expected

([note] This is because the send_email callback updates the ctime/mtime
variables the first time it runs after the file is created, so the
check_file callback doesn't consider it to have been modified.)

On the other hand, if /tmp/email_input does exist at the start of the
run, then:
  * only one email is sent [see note]
  * amanda continues to loop (silently), stat-ing /tmp/email_input every
    10 seconds
  * once I touch/modify the file, Amanda aborts as expected

([note] This is because the check_file callback cancels the send_email
timer as soon as it notices email_input exists.)


So, I guess the question is what's the desired behavior here?  

Off hand, I think I would expect  1) Amanda would send email every
resend-delay seconds as long as it is waiting (for whatever reason), and
2) Amanda should always wait for input_file to change in some way from
its initial state, but it shouldn't matter if that change is "creation"
or "modification".

If those are indeed the desired behavior, I'm wondering if email.pm
should be changed as follows:

  1) the send_email_cb function should never change
     $self->{'check_file_mtime'} and {' ...ctime'}, but instead one initial
     setting of those should be handed inside the 
        if ($check_file) {
           $check_file_cb->();
        }
     at the bottom of the main loop of "user_request" (before that
     initial call to the function).

  2) the check_file_cb function should not remove the send_email_src
     callback unless the mtime/ctime check succeeds.  (i.e. don't remove
     it just because $check_file exists, but only when $check_file has
     been modified and we're starting to read it).

I'll do some more testing later, but figured I should make sure I was
thinking about this correctly before going too much further...

Thanks.
						Nathan 

----------------------------------------------------------------------------
Nathan Stratton Treadway  -  [email protected]  -  Mid-Atlantic region
Ray Ontko & Co.  -  Software consulting services  -   http://www.ontko.com/
 GPG Key: http://www.ontko.com/~nathanst/gpg_key.txt   ID: 1023D/ECFB6239
 Key fingerprint = 6AD8 485E 20B9 5C71 231C  0C32 15F3 ADCD ECFB 6239
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.