kill and mails

rakubruxa

Registered
hi all,

i have a script that is run via cron. the script calls vm_stat with an interval (which make it run forever - it is run as a background process) to collect data. (the vm_stat pid is saved.) when the data collection is done, vm_stat is killed using the saved pid. it all works great. but, when the kill is done, an informational mail is generated that simply states that a "kill" was done. if the script runs every 5 minutes, the mails pile up. how can i suppress the mails?

btw, i also tried "killall vm_stat". again, it works great but the informational mails are still generated.

any help would be appreciated.

thanx,

john
 
Let's say your script is called /usr/local/bin/script and this is the command you put into your crontab, then just change the command in your crontab to read as:

/usr/local/bin/script >/dev/null 2>&1

which suppresses any output your script generates. This will prevent cron from sending any mail.
 
thanx for your response...

that seems to make sense, but it really doesn't work.

for some reason, the os seems to think that this output is an error. in the kill command i use:

kill xyz > /dev/null 2> /dev/null - i still get the mails.

if i redirect the output of the script:

the_script >> /dev/null 2>> /dev/null - ALL the errors are lost. i don't want all the errors to be lost - i just want this "kill" message to stop.
 
OK, so how about posting such a mail (including headers) here so that we can see where it originates?
 
it originates from cron.

i have redirected the standard output and error output of the cron job to a file. (actually the standard output was already redirected to the file.) the "kill" output is coming from the standard error.

the BIG question is, why is a "kill" that is working correctly (i.e. killing the process) sending out an ERROR message saying that it killed a process?

are we looking at a problem that can't be fixed?

as of now, the "kill" message is going to a file rather than a mail message - this still is not a fix.

i still don't know why the following line in the script does not take care of this situation:

kill abc > /dev/null 2> /dev/null - it works for ALL other commands for ALL flavors of unix.

thanx again for taking time to respond.
 
Back
Top