procmail
[Top] [All Lists]

Re: Working sms time check?

2016-06-01 11:46:51


On 01/06/16 16:41, @lbutlr wrote:
I think I have this working:

:0
* LISTNAME ??^^procmail^^
{
   SMS_TIME=`find . -mtime +24h -maxdepth 1 -name .SMS_$LISTNAME | sed 
's/^.......//'`
   :0
   * ! 9876543210^0 SMS_TIME ?? ^^$LISTNAME^^
   {
     LOG="touch .SMS_$LISTNAME"
     SMS_TIME=`touch .SMS_$LISTNAME`
     INCLUDERC=$HOME/.sms_procmail
     SWITCHRC
   }
   :0E
   {
     SWITCHRC
   }
}

LISTNAME is generated in another script, based on Sean’s script to extract the 
list name from a  variety of headers.

I know find is expensive, but the whole point of this is to alert me when there is a new post in a 
group that gets few posts, but not to alert me to every single post in case a thread gets activity 
for a day or two, so in theory these find’s should be firing quite rarely. One list, for 
example, I haven’t gotten posts from since early this year, but I don’t want to miss 
them.

I do not understand.  From the part that you show us:  if you get,
from the list 'procmail',  49 messages in  one hour - then  you will
get only one SMS, but, find(1) will be run 49 times in this hour, isn't?


If I have the logic right then if the find doesn’t match a file (either because 
the file is less than 24 hours old or because it does not exist) the file will be 
touched, the SMS notification script will load, and the script will pop back; 
otherwise if the file exists and is less than 24 hour hours old the script will simply 
pop back.


The trigger to check and send the SMS is new-message from the same list.
I can imagine a scenario where you send question; The answer came in less then 24 hours; Are you going to wait two weeks until somebody else will send another message to the list? Maybe trigger the SMS checking by crontab(1) is better?

--udi



____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)de
http://mailman.rwth-aachen.de/mailman/listinfo/procmail