nmh-workers
[Top] [All Lists]

Synchronization Problem

2020-07-24 11:04:54
fetchmail runs off a deamon and deposits emails which are in fine nmh format
but do not have a numeric names. So I run this script:

___________________
#!/bin/bash
newmh
dir=/home/norm/fetchdir/new
#for i in "$dir"/*
while true
do
  yes="no"
  for i in $(find $dir -mindepth 1 -type f)
    do
        refile -file $i +neo
        yes=true
     done
  test $yes == true && refile all -src +neo +inbox && spiel 2 mail
  sleep 300
done
_______________

Note 1: newmh is a bash function:
______________
newmh ()
{
    local oldContext="${MHCONTEXT-context}";
    local path=`mhpath +`;
    export MHCONTEXT=,"$oldContext.$$";
    cp "$path/$oldContext" "$path/$MHCONTEXT"
}
_______________

Note 2: spiel is a perl script which ultimately calls paplay, a pulseaudio
utility; paplay gives me no control over its timing or anyway to know
when it's done.

My problem is thatI and this script can step on each other's toes.

For example, I might interactively do:

scan +inbox
rmm last

But after the scan is complete and before I do the rmm, the script might
have put a new message in +inbox, which rmm would remove.

What to do??


    Norman Shapiro


<Prev in Thread] Current Thread [Next in Thread>