On Wed, 2007-10-10 at 09:47 +0100, Jenny Hopkins wrote:
Hullo there,
I'm trying to prevent a very simple script in cron.hourly from sending mail when it executes.
The script consists of
mount -a > /dev/null
I hoped the output would be directed to a black hole, but it sends a mail every hour as below.
/etc/cron.hourly/checkmounts: mount: knossos:/home already mounted or /nfshome busy mount: xios:/home already mounted or /nfshome-xios busy run-parts: /etc/cron.hourly/checkmounts exited with return code 32
Is the only way to prevent mail output to make the script more complicated with exit codes and whatnot?
Hi Jenny,
The > only redirects STDOUT, it wont redirect STDERR, which is why you're getting the messages.
Try the following
mount -a 2>&1 > /dev/null
The 2>&1 forces STDERR to goto STDOUT, which you caqn then send to /dev/null.
Hope that helps
Chris