The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Need to write a script in UNIX to find a file if another file exists mmdawg Shell Programming and Scripting 1 05-04-2008 07:40 PM
unix script to takes the old data from a TXT file and compress them into new file vpandey Shell Programming and Scripting 2 03-05-2008 08:10 AM
Shell Script to Load data into the database using a .csv file and .ctl file Csmani Shell Programming and Scripting 3 05-24-2006 05:09 AM
how to find Script file location inside script asami Shell Programming and Scripting 10 03-14-2006 09:57 PM
Reading file names from a file and executing the relative file from shell script anushilrai Shell Programming and Scripting 4 03-10-2006 02:25 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 04-12-2007
Registered User
 

Join Date: Jul 2003
Posts: 19
Log file for a Script

Oracle92 on solaris 8.

We have a Truncate Script that runs every night to cleanup certain tables , so new data gets loaded into. This Script is run in Unix Shell script where i set Environment varibles, and things like that..

Now, how do i create a log file of the script , to see weather the script really deleted the data ?

==========================
#!/bin/ksh
ORACLE_BASE=/u10/app/ORACLE
ORACLE_DOC=$ORACLE_BASE/doc
ORACLE_HOME=$ORACLE_BASE/product/9.2.0.1.0
ORACLE_SID=dss
PATH=/usr/bin:/usr/ucb:/usr/sbin:/etc:/usr/inform/PowerMart:/usr/inform/RepServer:/usr/inform/scripts:$ORACLE_HOME/bin:/usr/bin:/bin:/usr/ccs/bin:/usr/ucb:/etc:/usr/openwin/bin:/usr/local/bin:.
TNS_ADMIN=$ORACLE_HOME/network/admin
LD_LIBRARY_PATH=/usr/inform/PowerMart:/usr/inform/RepServer:$ORACLE_HOME/lib32
export PATH PM_HOME ORACLE_BASE ORACLE_HOME ORACLE_SID LD_LIBRARY_PATH TNS_ADMIN
export PARMS=/usr/inform/scripts/WorkFlow/dss_parms
ORADBUSER=`cat $PARMS |grep ORADBUSER|cut -d":" -f2`
ORADBPASSWD=`cat $PARMS |grep ORADBPASSWD|cut -d":" -f2`

$ORACLE_HOME/bin/sqlplus -s << EOF
$ORADBUSER/$ORADBPASSWD
set heading off;
set feedback off;
set echo off;
truncate table current_year;
commit;
=============================

Thanks
Ron
Reply With Quote
Forum Sponsor
  #2  
Old 04-12-2007
reborg's Avatar
Administrator
 

Join Date: Mar 2005
Location: Ireland
Posts: 3,590
The simplest way, assuming you are using cron to run the script is to redirect the cron job stdout and stderr to a file.
Reply With Quote
  #3  
Old 04-12-2007
Registered User
 

Join Date: Apr 2006
Location: Iraq
Posts: 34
Dear

if you are runnning the script from crontab,then the output will be mailed to the owner user.

also you can put the script output in one file and the error in another one as below

your_script.sh > outfile 2> errfile

Regards;
TheEngineer
IBM Certified Specialist
Reply With Quote
  #4  
Old 04-12-2007
Registered User
 

Join Date: Apr 2006
Location: Iraq
Posts: 34
i see in your script that you do "set echo off", however it is related to oracle ,to see the truncate command output set echo on so you will findout weather it truncate the table or not
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 02:10 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0