Log file being not generated in crontab


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Log file being not generated in crontab
# 1  
Old 07-22-2013
Log file being not generated in crontab

My shell script it.sh
Code:
#!/bin/sh
ORACLE_HOME=/var/opt/oracle/product/10g; export ORACLE_HOME
PATH=$PATH:$ORACLE_HOME/bin:/bin:/usr/bin; export PATH
today=`date "+%m-%d-%Y  %H:%M:%S"`; export today
CUR_DIR=$1; export CUR_DIR


LOG_FILE=error.log; export LOG_FILE

# Direct script output to log
exec > $LOG_FILE 2>&1

echo
echo
echo "LOGGING STARTS $today"
echo
echo
###Fetching the script directory from configuration file 
SCRIPT_DIR=`cat $CUR_DIR/.id_pass_file.txt | grep "^SCRIPT_DIR" | cut -d "=" -f2`; export SCRIPT_DIR

### Credentials for SQLPLUS

USER_ID=`cat $CUR_DIR/.id_pass_file.txt | grep "^USER_ID" | cut -d "=" -f2`; export USER_ID
PWD=`cat $CUR_DIR/.id_pass_file.txt | grep "^PWD" | cut -d "=" -f2`; export PWD
SID=`cat $CUR_DIR/.id_pass_file.txt | grep "^SID" | cut -d "=" -f2`; export SID


### Connecting ORACLE

echo "SQLPLUS CONNECTION"

sqlplus -s $USER_ID@$SID/$PWD<<EOF>$CUR_DIR/sql_output.txt
set feedback off
set heading off
select  1016 from adj where rownum <2;
EOF


if [ $? -eq 0 ] 
then 
echo " SQLPLUS Connection Successful "
else
echo " SQLPLUS Connection Failed "
fi

##echo " The account numbers to be used in BIP are  "



if [  ! -s  "$CUR_DIR/sql_output.txt" ]
then
echo "No account number for bad debt" 
else
for i in `cat $CUR_DIR/sql_output.txt`
do
echo "bip $i is running"
cd $SCRIPT_DIR
sh bip.sh 01 0 $i >  $CUR_DIR/bip_log_1.txt
sleep 100
done
fi


###Removing temporary log files generated 

if [  -f  $CUR_DIR/bip_log_1.txt ]
then
`rm  $CUR_DIR/bip_log_1.txt`
 echo "file bip__log_1.txt removed"
fi

if [  -f  $CUR_DIR/sql_output.txt ]
then
`rm  $CUR_DIR/sql_output.txt`
 echo "sql_output.txt removed"
fi

when i execute the script manually ,it is working fine but when i schedule this job in crontab error.log file is not generated

Why?
Please help me.

crontab entry

Code:
59 04 * * *  /arbor/integ_fx/rahul_raj/itsr_5652/it.sh /arbor/integ_fx/rahul_raj/itsr_5652

# 2  
Old 07-22-2013
try to put the full path here
Code:
 
LOG_FILE=/arbor/integ_fx/rahul_raj/itsr_5652/error.log

This User Gave Thanks to vidyadhar85 For This Post:
# 3  
Old 07-22-2013
I dont see any definition for this variable.

$LOG_FILE
# 4  
Old 07-22-2013
Suspect something to do with

Code:
/arbor/integ_fx/rahul_raj/itsr_5652

What is the purpose of this part of your command?
# 5  
Old 07-22-2013
Solved.Thanks

---------- Post updated at 05:44 PM ---------- Previous update was at 05:43 PM ----------

Quote:
Originally Posted by joeyg
Code:
/arbor/integ_fx/rahul_raj/itsr_5652

What is the purpose of this part of your command?
Its kind of redundant .
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Log file is not updating when I run shell scripts scheduled thru crontab

Hi Forum, Good Day! I have created an empty html file wtih permissoin 777 created shell script(with permission 777) , code is below. #=======================start============== . /data09/oracle/apps_st/appl/D_oraapp095.env rm -rf /home/mnp/Test_log.txt echo... (1 Reply)
Discussion started by: kartheekbk
1 Replies

2. UNIX for Dummies Questions & Answers

Log file generation from crontab

Hi All, Like to enquire whether is it possible for me to append another log file(log2.lst) using my below crontab? I will need to have 2 log files generated; one to collect the daily appended output and another log file that contains only the daily output. Original Code: 00 01 * * *... (2 Replies)
Discussion started by: snowfrost88
2 Replies

3. Shell Programming and Scripting

How to capture hostnames or ip address in the log files generated?

Team, I have prepared a script which I run from my remote machine(Jump-box)server Below is the script FILEDATE=`date +%F` LOGFILE=/home/abc/scripts/xyz.$FILEDATE.log find /home/abc/scripts/xyz.*.log -type f -mtime -3 -delete touch $LOGFILE exec 1>$LOGFILE 2>&1 #healthcheck batch runs... (1 Reply)
Discussion started by: whizkidash
1 Replies

4. Shell Programming and Scripting

Move all .log except those generated in the last 5 minutes

RHEL 5.8 In the directory /u03/pkms/app_logs I have several hundreds of log files as shown below. $ pwd /u03/pkms/app_logs $ ls -alrt *.log | tail -50 -rw-r----- 1 oracle dba 9439232 May 4 13:57 mvtpcem_1_722892404_94157.log -rw-r----- 1 oracle dba 9227264 May 4 13:57... (8 Replies)
Discussion started by: kraljic
8 Replies

5. Shell Programming and Scripting

Script to grep for a string in log files generated in last 15 minutes.

Dear Guru's I've a requirment to grep for a string in series of log files that are getting generated almost every minute. I'm looking to schedule a script every 15 mountes,in order to check if the error string has been generated in any of the log files generated in last 15 minutes. Please... (3 Replies)
Discussion started by: rajivatnova
3 Replies

6. Shell Programming and Scripting

Shell Script to grep Job File name and Log File name from crontab -l

Hello, I am new to shell scripting. I need to write a shell script where i can grep the name of file ie. .sh file and log file from crontab -l. #51 18 * * * /home/oracle/refresh/refresh_ug634.sh > /home/oracle/refresh/refresh_ug634.sh.log 2>&1 #40 17 * * * /home/oracle/refresh/refresh_ux634.sh... (1 Reply)
Discussion started by: guptra
1 Replies

7. Shell Programming and Scripting

Retrieve logs generated in last 10 mins from a log file using 'grep' command

HI All, I have a log file where the logs will be in the format as given below: 2011-05-25 02:32:51 INFO PROCESS STARTING 2011-05-25 02:32:52 INFO PROCESS STARTED . . . I want to retrieve only the logs which are less than 5 mins older than current time using grep... (3 Replies)
Discussion started by: rvhg16
3 Replies

8. UNIX for Dummies Questions & Answers

Log file not getting generated

Hi , Log file is not getting generated. any suggestion? Thanks date1=$(date '+%m/%d/%y-%H:%M:%S') log="wrapper.log.$date1" echo " somethng" > $log (2 Replies)
Discussion started by: ajincoep
2 Replies

9. UNIX for Advanced & Expert Users

Crontab Error - creating zero byte log file

Hi, I am trying to run a shell script using the crontab scheduler, and I am redirecting the log of the script output to some temp log file using the following command. sh somescript.sh 1> /location/somefile.log Evrytime the cronjob triggers this script, It creates a zero byte file in the... (4 Replies)
Discussion started by: DSDexter
4 Replies

10. Shell Programming and Scripting

get the last generated log file

Hi I need to get the last generated file in a directory using ls -ltr. I need to store the output of ls -ltr in a variable. it will like this $xyz = -rw-rw-r-- 1 sblp003 siebel 1060 Dec 18 13:33 from this output, I need to do a substring to get this value alone "Dec 18... (8 Replies)
Discussion started by: ragha81
8 Replies
Login or Register to Ask a Question