si-riesal schreef:
:0
* ^Subject: getresult stuid $STUID passid $PASSID
| echo "USE TEST; \
SELECT * \
FROM login \
WHERE id_student = $STUID \
AND passwd = $PASSID" \
| /usr/local/mysql/bin/mysql -t -n \
> $HOME/mail/"result.txt" ; \
(formail -r ; cat "result.txt") \
| $SENDMAIL -oi -t ; rm -r "result.txt"
I think that you are running the risk that two processes will write to
the same "result.txt".
Maybe you should use something like
RESULT = "result_$$.txt"
and use that variable. The "$$" contains the PID.
Also use lockfile with $$ in the name.
But ideally you would pipe the output of mysql into formail.
:0
* ^Subject: getresult stuid $STUID passid $PASSID
{ MYSQL = `mysql TEST -t -e "SELECT * FROM login
WHERE id_student = $STUID AND passwd = $PASSID"`
:0
* MYSQL ?? [^ ]
| (formail -r ; echo "${NL}${MYSQL}" ) | $SENDMAIL -oi -t
}
(untested)
--
Groet, Ruud
____________________________________________________________
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