Re: Working sms time check?

"@lbutlr" <[email protected]> Wed, 1 Jun 2016 23:31:25 -0600
Newsgroups gmane.mail.procmail
Message-ID <[email protected]>
On Jun 1, 2016, at 10:28 AM, udi M <[email protected]> wrote:
> 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?

Yes. But that has never happened in the last… 15 years? Also, procmail is not actually one of the lists I am tracking, these are even lower volume lists than this one. I setup procmail (and another list) as tests.

>> 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?

These aren’t issues.

The issue is that the find does not fill the variable.

SMS_TIME=`/usr/bin/find . -mtime +24h -maxdepth 1 -name .SMS_$LISTNAME | /usr/bin/sed 's/^.......//‘`

ALWAYS ends up with an empty SMS_TIME regardless of the time stamp on the file.


-- 
C code. C code run. Run, code, run.


____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
[email protected]
http://mailman.rwth-aachen.de/mailman/listinfo/procmail