[rhn-users] syntax of my cronjob

Nick Bruton nick.bruton at bristol.ac.uk
Thu Sep 8 13:39:15 UTC 2005


Swap the last | for a ;

Nick

--On 08 September 2005 09:33 -0400 Kvetch <kvetch at gmail.com> 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



----------------------------------------------------------------------------
Nick Bruton                                          PADI Divemaster #624215
University of Bristol                                Yamaha YZF R1
Computing Service
Tyndall Avenue
Bristol BS8 1UD
Tel: 0117 9288193

Team email: isys-srct at bris.ac.uk




More information about the rhn-users mailing list