<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Nick,<br>
<br>
You could just use the MAILTO option in cron and do not redirect any
output<br>
<a class="moz-txt-link-abbreviated" href="mailto:MAILTO=kvetch@gmail.com">MAILTO=kvetch@gmail.com</a><br>
0 5 * * * /opt/app/cron/runjob.sh<br>
<br>
Of course this would not give you the same subject line, but it is a
bit cleaner. Also it would trap \<br>
stderr and send it to you as well should anything go wrong in your
script.<br>
<br>
-- Donnie<br>
<br>
Kvetch wrote:<br>
<blockquote cite="mid12cc7470050908063318dcb291@mail.gmail.com"
type="cite">Hello, I am having some issues with a script I have in my
cron. I have a script that when it runs I would like to write out its
output to the screen into a file and then mail the contents of that
file to myself. The script takes about 2-5 minutes to finish
processing.
<br>
<br>
If I run the following a couple times I notice that it is actually
emailing the contents of the file before it finishes running the job
and if the job had run earlier then it sends me the contents of the
file the last time it ran.
<br>
#/opt/app/cron/runjob.sh > /opt/app/cron/runjob.out |cat
/opt/app/cron/runjob.out | mail -s "Job Output" <a
href="mailto:me@gmail.com">me@gmail.com</a><br>
<br>
So I added a rm command in the beginning thinking that this would
help. But it now sends out a blank email.
<br>
0 5 * * * rm /opt/app/cron/runjob.out | /opt/app/cron/runjob.sh >
/opt/app/cron/runjob.out |cat /opt/app/cron/runjob.out | mail -s "Job
Output" <a href="mailto:me@gmail.com">me@gmail.com</a><br>
<br>
So basically how can I write out the output of the script and email it
also while making sure it emails the contents of the file after the job
has been run? I need it to write out the file so I have access to it
for the entire day until the next time the cronjob runs.
<br>
I know my syntax is really poor so if anyone has any thoughts on how to
clean it up I would appreciate it.<br>
<br>
Thanks,<br>
Nick<br>
<pre wrap="">
<hr size="4" width="90%">
_______________________________________________
rhn-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rhn-users@redhat.com">rhn-users@redhat.com</a>
<a class="moz-txt-link-freetext" href="https://www.redhat.com/mailman/listinfo/rhn-users">https://www.redhat.com/mailman/listinfo/rhn-users</a></pre>
</blockquote>
<br>
</body>
</html>