Solved

Location of output from cron job

Posted on 2014-12-11
7
84 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
  • 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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 

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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

If you use Debian 6 Squeeze and you are tired of looking at the childish graphical GDM login screen that is used by default, here's an easy way to change it. If you've already tried to change it you've probably discovered that none of the old met…
1. Introduction As many people are interested in Linux but not as many are interested or knowledgeable (enough) to install Linux on their system, here is a safe way to try out Linux on your existing (Windows) system. The idea is that you insta…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

747 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now