UNIX--Check Process not found error


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting UNIX--Check Process not found error
# 1  
Old 10-31-2012
UNIX--Check Process not found error

hi guys can you please help me i have the following script to load to a database but when i execute it...its saying Check_Process: not found

Code:
#!/bin/ksh

##-To load Oracle user profile

##./monitor_io.ksh
##./test.ksh

SCP_DIR=/export/home/yani_m/scripts


LOG_DIR=${SCP_DIR}/log/IOSTATS
BAD_DIR=${SCP_DIR}/bad/IOSTATS
CTL_FILE=${SCP_DIR}/IOSTATS
PAR_FIL=${SCP_DIR}/parfile/IOSTATS.par
DSC_DIR=${SCP_DIR}/discard/IOSTATS
BCK_UP_DIR=${SCP_DIR}/BCK_UP_DIR_IOSTATS

##-Check if there is no current instance of this script is running

Check_Proces ()
{
PS_NAME=`echo $0 | awk -F/ '{ print $NF }' | awk '{ print $1 }'`
ACTIVE=`ps -ef |grep $PS_NAME |grep -v "sh -c" |grep -v grep |wc -l`
echo $PS_NAME $ACTIVE
if [ $ACTIVE -ge 2 ];  then
   echo "An instance of the script is already running : " $PS_NAME
   exit
fi
}

##-Check if the file to load exist in the directory and load it

Load_Stats()
{
cd ${SCP_DIR}

for file in `ls -1|grep FILE_TO_LOAD.dat`
do
   if(test -s $file)
   then
       sqlldr parfile=${PAR_FIL}/$file.par control=${CTL_FILE}/$file data=${DATA_FIL}/$file LOG=${LOD_DIR}/$file.log BAD=${BAD_DIR}/$file.bad
   fi
##-send notification if loader fails
   if [ $? -eq 1 ]
   then
     echo "LOADER FAILED TO LOAD THE FILE"
   fi

##-check for errors in the log file

  ORAerr=`cat ${LOG_DIR}/${file}.log | grep ORA- |grep -v ORA-00001`
      ORAerrtmp=`echo $ORAerr| awk '{print substr($1,1,3)"-"}'`
      if [ $ORAerrtmp == "ORA-" ];
      then
         echo"File not loaded sent to discard directory"
         mv ${file}/$DSC_DIR}
     exit
     else
         mv $file ${BCK_UP_DIR}
    fi
done
}

Check_Process
Load_Stats


Last edited by Scott; 10-31-2012 at 10:40 AM.. Reason: Please use code tags
# 2  
Old 10-31-2012
You missed s in Check_Proces ()

Please correct it and re-try.
# 3  
Old 10-31-2012
Do I see a typo there?
Code:
Check_Proces ()

# 4  
Old 10-31-2012
Tools

thanks....careless programming...
# 5  
Old 10-31-2012
Quote:
Originally Posted by LucyYani
Check_Proces ()
{
..
}

Check_Process
Spelling mistake...Smilie
# 6  
Old 10-31-2012
thanks..guys..

---------- Post updated at 03:44 PM ---------- Previous update was at 03:41 PM ----------

How do i view if the data is loaded to my oracle DB?
# 7  
Old 10-31-2012
One way is to check if there are any records discarded in the bad file created by sqlldr utility. Or you can connect to oracle DB via sqlplus and check those tables in which data is loaded.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

UNIX shell script error: not found

Hello All, I'm working on one Unix shell sript that will actually extract a column data from Oracle table using sqlplus and writes onto a file. I'm getting this error when executing the shell script: rpt.ksh: ^JScott: not found Below is the code in the shell script: `sqlplus -s... (1 Reply)
Discussion started by: venkat_reddy
1 Replies

2. UNIX for Dummies Questions & Answers

How a process can check if a particular process is running on different machine?

I have process1 running on one machine and generating some log file. Now another process which can be launched on any machine wants to know if process1 is running or not and also in case it is running it wants to stream the logs file generated by process1 on terminal from which process2 is... (2 Replies)
Discussion started by: saurabhnsit2001
2 Replies

3. UNIX and Linux Applications

Unix pkill error; does wily obstruct me killing the process?

have two scripts on Unix; one that starts some processes and the other one for killing a process. At first, I ran the .sh without WILY in it and it worked perfectly; in this way, I could also ran my stopper process. However I need WILY in this so I added it to my script but this time, a message... (1 Reply)
Discussion started by: nerdogan551
1 Replies

4. Shell Programming and Scripting

How to check for a specific process running or not in Unix

I have used ps -ef | grep <process name> to see if the process is still running or not. But, not being able to find anything in particular. Any clue on this... (4 Replies)
Discussion started by: Haimanti
4 Replies

5. Shell Programming and Scripting

Shell stop process after found value in file

hi guys can somebody help me here... i've a file that contains total of ip that connects to my server and their ip like this : 80 80 xxx.xxx.xx.xxx 75 75 xxx.xxx.xx.xxx 73 73 xxx.xxx.xx.xxx where first columns and second were the total connections... ... (0 Replies)
Discussion started by: kriezo
0 Replies

6. UNIX for Dummies Questions & Answers

How to check process/cpu utilisation thru unix shell scripting

Dear Champs, Can anybody help me out to write a shell script , which will check whether the process is running , if running then divide the process into 2 so that next var it can take process parallel . Let ps -ef | grep a.sh => shows running note a.sh will take a process of next... (0 Replies)
Discussion started by: manas_ranjan
0 Replies

7. Shell Programming and Scripting

Ambiguous and Command not found Error in UNIX

Hi,All I wrote below script(Example1.sh) and i ran but i got error. it's excuted yesterday. SYSTEM_TIME=`date '+%H:%M:%S'` CMP_LOG_TIME=`head -1 runcmp-HINET.log` CMP_ENDED1=`grep 'HINET CMP ended' runcmp-HINET.log` CMP_ENDED2=`echo "HINET CMP ended"` CMP_FAILED2=`echo "HINET CMP... (2 Replies)
Discussion started by: koti_rama
2 Replies

8. UNIX for Dummies Questions & Answers

Ambiguous and Command not found Error in UNIX

Hi,All I wrote below script(Example1.sh) and i ran but it giveing error. it's excuted yesterday. SYSTEM_TIME=`date '+%H:%M:%S'` CMP_LOG_TIME=`head -1 runcmp-HINET.log` CMP_ENDED1=`grep 'HINET CMP ended' runcmp-HINET.log` CMP_ENDED2=`echo "HINET CMP ended"` CMP_FAILED2=`echo "HINET... (2 Replies)
Discussion started by: koti_rama
2 Replies

9. Shell Programming and Scripting

how can i check in csh if command found or not found ?

hello all im trying to use in sun Solaris the information received from the top command now i several machines that dont have install the top program so when im running the script im geting error saying after im running this code : set MemoryInfo = `top | grep Memory` if (... (2 Replies)
Discussion started by: umen
2 Replies
Login or Register to Ask a Question