Dears,
i have user called dellsh
i hope to make this script
when this user recieve email
check the budy of the email about (StatusRequest)
when i find this email contain this subject
run crontab do this job (create file in my home directory called index)
thanks for your attention
The users in coming mail could be stored in a file such as /var/mail/dellsh, talking that as an example then you could write a script that greps for the subject heading you ar looking for and once done use sed to change the subject heading to prevent the job being run repeatedly? You could try:
MAILFILE=/var/mail/dellhs
if [ -n "`grep StatusRequest ${MAILFILE}`" ]; then
create_index_file
RESULT=$?
if [ ${RESULT} -eq 0 ]; then
sed '/s/StatusRequest/StatusDoneRequest/' ${MAILFILE} > ${MAILFILE}.$$ && \
cp ${MAILFILE}.$$ ${MAILFILE} && \
rm ${MAILFILE}.$$
fi
fi
So you'd put the above in a script and call it from cron, if there is no "StatusRequest" in the mail then it does nothing.
I don't have a machine that receives email so I cannot try it.