The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Appending date to filename aemunathan Shell Programming and Scripting 5 05-12-2008 04:21 AM
appending a file using sed in ksh smac Shell Programming and Scripting 3 01-02-2008 01:09 PM
Reading specific contents from a file and appending it to another file dnicky Shell Programming and Scripting 5 10-04-2005 02:45 AM
appending a file chumba UNIX for Dummies Questions & Answers 1 05-24-2001 08:09 AM
Appending out to a file Astudent UNIX for Dummies Questions & Answers 1 10-19-2000 11:17 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 01-24-2008
Registered User
 

Join Date: Oct 2007
Posts: 11
Date Not appending in log file

Hi experts . . .

Sunsolaris 9 version

I have the script as below:

Am getting log file as : archive_today_.log

Please suggest.

##################################################
set 'date'
dd=$3
mon=$2
export mon
yyyy=$6
export yyyy

cd /oracle/P47/saparch

LOG_FILE=/oracle/P47/saparch/archive_today_$date.log
echo "*******************************************************************">> $LOG_FILE

date >> $LOG_FILE

sqlplus "/as sysdba"<< EOF >> $LOG_FILE
set serveroutput on ;
set time on ;
recover automatic standby database;
CANCEL
exit
EOF

echo "Finish applying archives in SAP DR site..." >> $LOG_FILE

echo " ----------------------------------------------------------">> $LOG_FILE

echo "End SAP DR script " >> $LOG_FILE
echo "=========================================================" >> $LOG_FILE
.................................................................................................... .
Reply With Quote
Forum Sponsor
  #2  
Old 01-24-2008
Registered User
 

Join Date: Nov 2003
Posts: 9
Hi,
Am I completely misunderstanding the problem here maybe? But the variable 'date' is never set anywhere ?!

Why not :
datestamp=$(date +'%d%m%Y')
LOG_FILE=/oracle/P47/saparch/archive_today_$datestamp.log
...
Reply With Quote
  #3  
Old 01-24-2008
Registered User
 

Join Date: Oct 2007
Posts: 11
Hi domivv,

thanks for reply . . . I modified like this:
#set 'date'
datestamp=$(date +'%d%m%Y')
dd=$3
mon=$2
export mon
yyyy=$6
export yyyy

cd /oracle/P47/saparch

LOG_FILE=/oracle/P47/saparch/archive_today_datestamp.log


I got following error:

archives_apply.sh: syntax error at line 11: `datestamp=$' unexpected
Reply With Quote
  #4  
Old 01-24-2008
Registered User
 

Join Date: Mar 2007
Location: Chennai
Posts: 222
Quote:
Originally Posted by vrjalli View Post
Hi domivv,

thanks for reply . . . I modified like this:
#set 'date'
datestamp=$(date +'%d%m%Y')
dd=$3
mon=$2
export mon
yyyy=$6
export yyyy

cd /oracle/P47/saparch

LOG_FILE=/oracle/P47/saparch/archive_today_datestamp.log


I got following error:

archives_apply.sh: syntax error at line 11: `datestamp=$' unexpected
This is KSH syntax,You may try it with datestamp=`date +'%d%m%Y'`

Thanks
Nagarajan G
Reply With Quote
  #5  
Old 01-24-2008
Registered User
 

Join Date: Oct 2007
Posts: 11
Hi Nagrajan,

now script is like:

#set 'date'
datestamp='date +'%d%m%Y''
dd=$3
mon=$2
export mon
yyyy=$6
export yyyy

cd /oracle/P47/saparch

LOG_FILE=/oracle/P47/saparch/archive_today_datestamp.log


and output log file is:

archive_today_datestamp.log it is not picking date values. . .

rgds
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 07:00 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