[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Bash script & Cronjob mail
From: |
Manuel Ifland |
Subject: |
Bash script & Cronjob mail |
Date: |
Mon, 8 Oct 2001 16:29:09 +0200 |
Hello,
it is not really a bug, but it's annoying me:
I have written a Bash script to automatically check for new mails with
fetchmail. After calling fetchmail, I check the variable $? that fetchmail
returns. If new mail is waiting, a sound is played. This script is invoked
by cron every 5 minutes.
My problem is that everytime when cron invokes the script, I get a mail from
the cron-daemon that contains the results of fetchmail. If I try to redirect
the fetchmail output to /dev/null in the script, I also get a mail every
time a mail has been fetched. This mail says "function unimplementet".
Setting >>MAIL=""<< in my cronjob has no effect.
Even it is not possible to specify a parameter in my script (e.g.
fetchmail --silent). If I do this, cron sends a mail that also says
"function unimplementet". If I use the "exec" command, I am no longer able
to check the varible $?.
I am using Linux 2.4.10.
This is my script:
-------------------------------------------
#!/bin/sh
/usr/bin/fetchmail>/dev/null
if [ $? = 0 ]
then
play sound.wav
fi
--------------------------------------------
How can I prevent cron from sending me the fetchmail output? How can I
specify parameters in my script for fetchmail?
Thank you very much in advance,
Manuel.
- Bash script & Cronjob mail,
Manuel Ifland <=