|
|
#1 |
|
Prospect
Join Date: May 2005
Posts: 4
|
Hi all,
I am new to cron, but have (with the help of the mailman list) figured out a way to create a cron event. The problem is that I am now getting an email everytime the script runs. I have no interest in receiving this message every 15 minutes of the day. Running OS 10.3.9 Server on a colo Xserve. Any help would be greatly appreciated. |
|
|
|
|
|
#2 |
|
Prospect
Join Date: Dec 2004
Posts: 39
|
Add this to the end of your cron line:
Code:
>/dev/null 2>&1 Code:
15 * * * * runme.sh >/dev/null 2>&1 |
|
|
|
|
|
#3 |
|
MVP
Join Date: Jun 2002
Location: Tucson, Arizona
Posts: 1,236
|
That will redirect the output of whatever command to /dev/null, but cron will still email status messages. What you need to do is set MAILTO to null. The syntax (in your crontab file) is:
MAILTO="" Note that this was covered in another recent thread. update: miscopied the thread address (left off an 8). thanks for the catch, cpragman Last edited by nkuvu; 05-26-2005 at 09:24 AM. |
|
|
|
|
|
#4 |
|
All Star
Join Date: Jan 2004
Location: Limerick, PA
Posts: 858
|
Actually, it's this thread.
Put the parameter on a line by itself in the crontab file (i.e., at the top of the file). Code:
MAILTO=""
Code:
#
#
MAILTO=""
#
30 * * * * /Users/Shared/Staff/Applications/sharenice.csh
@reboot cd /Users/cpragman/Applications/FAH5; ./fah5 -local -advmethods -forceasm -verbosity 9 &
#SqzS VERSION = 1.0.0
#SYMANTEC SCHEDULER CRON ENTRIES. THESE ENTRIES ARE AUTOMATICALLY GENERATED
#PLEASE DO NOT EDIT.
# Enc=1 Name="FileSaver Daily Update" EvType1=3 EvType2=0 Sched=3
0 12 * * * "/Library/Application Support/Norton Solutions Support/Scheduler/schedLauncher" 0 "/Library/Application Support/Norton Solutions Support/Norton Utilities/Norton Volume Assist" " " "oapp" "aevt" "exAG" "-d0"
# Enc=1 Name="Daily Defragmentation" EvType1=4 EvType2=0 Sched=3
0 0 * * * "/Library/Application Support/Norton Solutions Support/Scheduler/schedLauncher" 0 "/Library/Application Support/Norton Solutions Support/Norton Utilities/Norton Defragger" " " "oapp" "aevt" "exAG" "-d0"
# Enc=1 Name="Update Virus Protection" EvType1=1 EvType2=0 Sched=1
0 18 1 * * "/Library/Application Support/Norton Solutions Support/Scheduler/schedLauncher" -u 0 "/Applications/Norton Solutions/LiveUpdate.app/Contents/MacOS/LiveUpdate" " " "oapp" "aevt" "exAG" "-update LUdf"
#SqzS END SYMANTEC CRON ENTRIES
|
|
|
|
|
|
#5 | |||||||||||||||||||||||
|
Prospect
Join Date: May 2005
Posts: 4
|
re: stop cron from sending mail
Thanks for the replies. I did the above, will see if it works. Sorry about reposting after the issue had already been addressed in a previous thread. I did search the archives, but did not see it. |
|||||||||||||||||||||||
|
|
|
|
|
#6 |
|
Prospect
Join Date: Dec 2004
Posts: 39
|
The MAILTO thing is great if you never want to receive email from cron, but when debugging an automated process, sometimes you want to receive mail from one or more (but maybe not all) cron jobs. That's why I usually do it line by line as listed above. It's all about having options.
|
|
|
|
|
|
#7 |
|
Prospect
Join Date: May 2005
Posts: 4
|
Well I tried it but it did not work.
I added MAILTO="" to my /etc/crontab file. It is for user mailman, who as far as I can tell does not have its own crontab file. Any other suggestions? |
|
|
|
|
|
#8 |
|
MVP
Join Date: Jun 2002
Location: Tucson, Arizona
Posts: 1,236
|
After you add the MAILTO to the cron file, you have to tell crontab to update it:
crontab filename It doesn't happen automagically. Did you do this? |
|
|
|
|
|
#9 | |||||||||||||||||||
|
Prospect
Join Date: May 2005
Posts: 4
|
Ok, so I have restarted the script, as described above. I am still getting emails. Here is a copy of my /etc/crontab file.
Now that I look at the above code, I don't see the script, thought it is clearly running. The user is mailman. Is there another file that I should be looking for? I am running this through webmin. I do know how to use the terminal and pico into a file as well. Thanks for your patience. |
|||||||||||||||||||
|
|
|
|
|
#10 |
|
All Star
Join Date: Jan 2004
Location: Limerick, PA
Posts: 858
|
If you modified /etc/crontab, then you changed ROOT's behavior, so you shouldn't get any more e-mails from the various root maintenance tasks that run.
If you have users with cron scripts, they are edited a different way. Check out man crontab. You can't really edit a user's cron file directly. The closest you can come is "crontab -e username", which will open a vi editor session of the username in question's crontab file. (You might need "sudo crontab -e username" for a user other than yourself). If your system has an imaginary user names mailman that is generating the e-mails, then you need to "sudo crontab -e mailman", and add the MAILTO="" line to that users crontab file. |
|
|
|
|
|
#11 |
|
Triple-A Player
Join Date: Oct 2003
Location: Philadelphia, PA, USA
Posts: 80
|
i use this quick bash script to track down weird cron entries.
Code:
#!/bin/sh for name in `nireport . /users name`; do echo -n "$name: " sudo crontab -u $name -l done |
|
|
|
![]() |
|
|