[rhn-users] syntax of my cronjob
Kvetch
kvetch at gmail.com
Thu Sep 8 13:33:25 UTC 2005
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/rhn-users/attachments/20050908/df1333a5/attachment.htm>
More information about the rhn-users
mailing list