Solved

Location of output from cron job

Posted on 2014-12-11
7
100 Views
Last Modified: 2014-12-12
I 'm to run a script in cron but i'm not finding the output.  When i run manually, the output is right in the directory from which i execute.

select value || '_' output
from v$parameter where name = 'db_name';
spool lfsdiag_&&dbname&&timestamp&&suffix

what directory will this  lfsdiag_&&dbname&&timestamp&&suffix go when i run from cron?
0
Comment
Question by:xoxomos
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
7 Comments
 

Author Comment

by:xoxomos
ID: 40495491
Running RH5.7
0
 

Author Comment

by:xoxomos
ID: 40495494
crontab entry is :
55 20 * * 5 /home/oracle/scripts/lfsdiag.sh
~
0
 
LVL 18

Expert Comment

by:TobiasHolm
ID: 40495513
Put the path before the filename.

Try:

from v$parameter where name = 'db_name';
spool "/var/log/myfolder/"&&lfsdiag_&&dbname&&timestamp&&suffix

Create a folder and set rights so that the script can write to it.
mkdir /var/log/myfolder
chmod 777 /var/log/myfolder

Use appropriate users, groups and chmod on the folder. Above is just an example.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:xoxomos
ID: 40495529
--spool lfsdiag_&&dbname&&timestamp&&suffix
spool "/home/oracle/tosupport"&&lfsdiag_&&dbname&&timestamp&&suffix

-bash-3.2$ pwd
/home/oracle
-bash-3.2$ ls -la tosupport
total 8
drwxrwxrwx  2 oracle oinstall 4096 Dec 11 21:51 .
drwxr-xr-x 16 oracle oinstall 4096 Dec 11 22:16 ..


Not getting anything in tosupport directory
0
 
LVL 18

Accepted Solution

by:
TobiasHolm earned 500 total points
ID: 40495632
Try to redirect output using > :

spool lfsdiag_&&dbname&&timestamp&&suffix > "/home/oracle/tosupport/test.log"

If it works you can try:

spool lfsdiag_&&dbname&&timestamp&&suffix > "/home/oracle/tosupport/"&&lfsdiag_&&dbname&&timestamp&&suffix
0
 

Author Comment

by:xoxomos
ID: 40497147
Cron line:
57 11 * * * /home/oracle/scripts/lfsdiag.sh > /home/oracle/tosupport/neils_test
spool line
spool lfsdiag_&&dbname&&timestamp&&suffix > "/home/oracle/tosupport/"&&lfsdiag_&&dbname&&timestamp&&suffix


This works....sortta :-)
The output comes with a mix of what i'm expecting and some errors .
When run throu cron
ASH WORST MINUTES FOR LOG FILE SYNC WAITS:

APPROACH: These are the minutes where the avg log file sync time
was the highest (in milliseconds).
order by 1,2
*
ERROR at line 8:
ORA-00936: missing expression

*******************************************************************
When run manually

ASH WORST MINUTES FOR LOG FILE SYNC WAITS:

APPROACH: These are the minutes where the avg log file sync time
was the highest (in milliseconds).

MINUTE          INST_ID EVENT                            TOTAL_WAIT_TIME      WAITS   AVG_TIME_WAITED
------------ ---------- ------------------------------ ----------------- ---------- -----------------
Dec11_2207            1 log file sync                          84745.374        275           308.165
Dec11_2216            1 log file sync                          27926.352         91           306.883
Dec11_2218            1 log file sync                          22417.809         80           280.223
 

I'm assuming it's another one of those differences depending on the environment the script is run in.
0
 

Author Closing Comment

by:xoxomos
ID: 40497149
Mil gracias
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my business, I use the LTS (Long Term Support) versions of Linux. My workstations do real work, and so I rarely have the patience to deal with silly problems caused by an upgraded kernel that had experimental software on it to begin with from a r…
This article will explain how to establish a SSH connection to Ubuntu through the firewall and using a different port other then 22. I have set up a Ubuntu virtual machine in Virtualbox and I am running a Windows 7 workstation. From the Ubuntu vi…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question