Discussion:
Working sms time check?
@lbutlr
2016-06-01 13:41:34 UTC
Permalink
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.

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.
--
How do I set my laser printer to "STUN"?


____________________________________________________________
procmail mailing list Procmail homepage: http://www.procmail.org/
***@lists.RWTH-Aachen.de
http://mailman.rwth-aach
@lbutlr
2016-06-01 14:22:52 UTC
Permalink
Post by @lbutlr
: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
}
}
Evidently not, but I don’t know why. I get this in the logs:

procmail: Match on “^^procmail^^"
procmail: Executing "find . -mtime +24h -maxdepth 1 -name .SMS_$LISTNAME | sed 's/^.......//'"
procmail: Assigning "SMS_TIME=“
procmail: Score: 0 0 "^^$LISTNAME^^"
procmail: Assigning "LOG=touch .SMS_procmail

touch .SMS_postfix
procmail: Executing "touch,.SMS_procmail"

So, the negation is not working as I expect.

Also, in the line where it is executing the find, $LISTNAME doesn’t get expanded, but in the touch line, it does.
--
If there's a bustle in your hedgerow don't be alarmed now.


____________________________________________________________
procmail mailing list Procmail homepage: http://www.procmail.org/
***@lists.RWTH-Aachen.de
http://mailman.rwth-aachen.de/mailman/lis
udi M
2016-06-01 16:28:49 UTC
Permalink
Post by @lbutlr
: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?
Post by @lbutlr
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/
***@lists.RWTH-Aachen.de
http:
@lbutlr
2016-06-02 05:31:25 UTC
Permalink
Post by udi M
Post by @lbutlr
: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.
Post by udi M
Post by @lbutlr
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/
***@lists.RWTH-Aachen.de
http://mailman.rwth-
Ruud H.G. van Tol
2016-06-02 06:30:12 UTC
Permalink
Post by @lbutlr
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.
1. Use an absolute path, instead of the dot.

2. What are the 7 characters that the sed-command is supposed to remove?
Just put them in the command.

3. There is a weird closing-quote at the end of the sed parameter.

4. Log every step, while testing.

-- Ruud

____________________________________________________________
procmail mailing list Procmail homepage: http://www.procmail.org/
***@lists.RWTH-Aachen.de
http://mailman.rwth-aachen.de/ma
@lbutlr
2016-06-02 21:18:39 UTC
Permalink
Post by Ruud H.G. van Tol
Post by @lbutlr
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.
1. Use an absolute path, instead of the dot.
The touch command creates the file in the right directory, but yes, I can try that.
Post by Ruud H.G. van Tol
2. What are the 7 characters that the sed-command is supposed to remove?
Just put them in the command.
"./.SMS_” I want to end up with jut the $LISTNAME in SMS_TIME so that I can later check

LISTNAME ?? ^^$SMS_TIME^^
Post by Ruud H.G. van Tol
3. There is a weird closing-quote at the end of the sed parameter.
I think that is an artifact of my mailer “smartening” the quote, but I will double check.
Post by Ruud H.G. van Tol
4. Log every step, while testing.
Yeah, that’s how I figured out the field is always empty, regardless.

Wil report back, the machine is doing a backup now.
--
'I'll see you all tomorrow. If there is one.'


____________________________________________________________
procmail mailing list Procmail homepage: http://www.procmail.org/
***@lists.RWTH-Aachen.de
http://mailman.rwth-aachen.de/mailman
@lbutlr
2016-06-02 21:47:27 UTC
Permalink
Post by @lbutlr
Wil report back, the machine is doing a backup now.
Interesting.

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

Yields the following:

Executing "/usr/bin/find $MAILDIR -mtime +24h -maxdepth 1 -name .SMS_$LISTNAME | /usr/bin/sed 's/^.......//‘"

Notice the lack of expansion.

procmail: Assigning "SMS_TIME="
procmail: Executing "/usr/bin/find,/home/kremels/Maildir/,-mtime,+24h,-maxdepth,1,-name,.SMS_procmail"

Here we get variable expansion

procmail: Assigning "SMS_TIME="
procmail: Executing "echo $SMS_TIME | /usr/bin/sed 's/^.......//‘“

And here there is no variable expansion.

procmail: Assigning "SMS_TIME="

(It is correct that SMS_TIME is empty at this point)
--
'I'm just going to kick some arse dear' 'Oh, good. Just be sure you wrap
up well, then.'
@lbutlr
2016-06-02 22:56:14 UTC
Permalink
Post by @lbutlr
SMS_TIME=`/usr/bin/find $MAILDIR -mtime +24h -maxdepth 1 -name .SMS_$LISTNAME | /usr/bin/sed 's/^.......//'`
SMS_TIME=`/usr/bin/find $MAILDIR -mtime +24h -maxdepth 1 -name .SMS_$LISTNAME`
SMS_TIME=`echo $SMS_TIME | /usr/bin/sed 's/^.......//'`
This works:

SMS_TIME=`/usr/bin/find $MAILDIR -mtime +24h -maxdepth 1 -name .SMS_$LISTNAME`
SMS_TIME=`basename $SMS_TIME`
--
if you ever get that chimp off your back, if you ever find the thing
you lack, ah but you know you're only having a laugh. Oh, oh here we
go again -- until the end.
Loading...