crontab issue

Can someone help with a cron issue on a Sun Solaris 9 machine? The problem I am having is that one of my cron jobs is sending output to the /var/mail/root and I am trying to get it to stop. I have other cron jobs that are running that do not place any output to that location. They do however send e-mails to there respected places as designated. I have checked the script that cron is running and all references show that it is only suppose to send an email if an error is found. I have run the script manually, while the root file was cleared out, and nothing is written to the root file. However, when I run it as a cron job I get data output sent to /var/mail/root. Is there another config file for crontab that I need to look at and disable output to /var/mail/root. Any help would be greatly appreciated.

Thanks,
Karsten

And what are the differences between the cron entries? Post the entries to give more info or check for > /dev/null 2>&1 at the end of the ones that work correctly.

Here are a couple of examples:

This one works fine
# e-mail messages log nightly to Sun folder
59 23 * * * nice /scheduled_jobs/log_monitor/logmon.sh 2>&1

This is the one that sends the output to /var/mail/root.
# e-mail warning messages detected each hour to Sun folder
59 * * * * nice //scheduled_jobs/watchlog/watchlog.sh 2>&1

Thanks for your help on this.

Karsten

Yes, those are set up to produce output.

Read RTMs post carefully do you notice anything about > /dev/null that you don't have?

I did read his post carefully, and I posted two examples that show both without > /dev/null. One does not produce output, and one does. I wanted to make sure if that was what I needed to do, or if there was something else needed. I am new to Sun systems and want to make sure I don't mess anything up.

Thanks,
Karsten

Well, cron jobs are controlled in the crontab so I would image there is still something different between the entries. I doubt it's a re-direction inside the script (but that may be). I can't seem to get the same problem to occur on a Solaris 9 system.

Set up a couple of tests - have the scripts exactly the same except in how they are set up in crontab (run the same script that echo's out anything)
Then set up 3 different jobs

          • /mydirectorypath/mytestscript1 > /tmp/mytestscript1
          • /mydirectorypath/mytestscript2 2>&1
          • /mydirectorypath/mytestscript3 > /dev/null 2>&1

Check to see if each sends to your /var/mail/root - make sure each script has a different echo "this is script 1" so you can tell. If nothing is different (it acts like it's suppose to) then you may need to start investigating the working scripts that aren't working correctly.

I would say it's just that one produces output the other doesn't, any output from cron will send be sent as mail to the invoking crontab's owner. If there is ANY output from the script that is the problem.