[rhn-users] syntax of my cronjob

Kvetch kvetch at gmail.com
Thu Sep 8 19:04:56 UTC 2005


Thanks guys. It is working fine now.

On 9/8/05, Donald Lambert <donald.lambert at dal.ca> wrote:
> 
> Nick,
> 
> You could just use the MAILTO option in cron and do not redirect any 
> output
> MAILTO=kvetch at gmail.com
> 0 5 * * * /opt/app/cron/runjob.sh
> 
> Of course this would not give you the same subject line, but it is a bit 
> cleaner. Also it would trap \
> stderr and send it to you as well should anything go wrong in your script.
> 
> -- Donnie
> 
> Kvetch wrote:
> 
> 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. 
> 
> 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. 
> #/opt/app/cron/runjob.sh > /opt/app/cron/runjob.out |cat 
> /opt/app/cron/runjob.out | mail -s "Job Output" me at gmail.com
> 
> So I added a rm command in the beginning thinking that this would help. 
> But it now sends out a blank email. 
> 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" me at gmail.com
> 
> 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. 
> I know my syntax is really poor so if anyone has any thoughts on how to 
> clean it up I would appreciate it.
> 
> Thanks,
> Nick
> 
> ------------------------------
> 
> _______________________________________________
> rhn-users mailing list
> rhn-users at redhat.comhttps://www.redhat.com/mailman/listinfo/rhn-users
> 
>  
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/rhn-users/attachments/20050908/bf2cd598/attachment-0001.htm>


More information about the rhn-users mailing list