Odd error on grep


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Odd error on grep
# 1  
Old 02-14-2014
Odd error on grep

GNU/Linux 2.6.18-308.24.1.el5

I am debugging an existing script. I am getting an error
HTML Code:
Script_Error at line [ 202 ]
Program Completed...
but, Line 202 is
Code:
grep Script_Error $log_file

Code:
##############################################################################
####            S C R I P T   E r r o r   C h e c k i n g  B E G I N :
##############################################################################
grep Script_Error $log_file

if [ "$?" -eq "0" ]

 then

  echo Script error has occurred!

   # Send error mail
        echo "Script failure: rubinandraine_nb_ftp.ksh " > /tmp/rubinandraine_nb_ftp.txt
        echo "" >> /tmp/rubinandraine_nb_ftp.txt
        echo "LOCATION/TIME ON SCHEDULER: FTP ProFit Jobs: FTP Profit R&R PreCollections NEWBUS at 0630" >> /tmp/rubinandraine_nb_ftp.txt
        echo "Extract location and time on the Scheduler (Previous night): Profit Operations: PROFIT PRECOLLECTIONS - R&R  at 2110" >> /tmp/rubinandraine_nb_ftp.txt
        echo "" >> /tmp/rubinandraine_nb_ftp.txt
        cat $log_file >> /tmp/rubinandraine_nb_ftp.txt
        echo "" >> /tmp/rubinandraine_nb_ftp.txt
        echo "Rerun the above OPSView job and call Helen or Mike if the error persists." >> /tmp/rubinandraine_nb_ftp.txt
        echo "" >> /tmp/rubinandraine_nb_ftp.txt
        echo "Exiting the script with a failed status..." >> /tmp/rubinandraine_nb_ftp.txt
        mailx -s "BACKEND Script ERROR!  ksh script failure: rubinandraine_nb_ftp.ksh" $mailList2 < /tmp/rubinandraine_nb_ftp.txt

        #       Update the log file
        echo "Script failure: rubinandraine_nb_ftp.ksh " >> $log_file
        echo ""
        echo "LOCATION/TIME ON SCHEDULER: FTP ProFit Jobs: FTP Profit R&R PreCollections NEWBUS at 0630" >> $log_file
        echo "Extract location and time on the Scheduler (Previous night): Profit Operations: PROFIT PRECOLLECTIONS - R&R  at 2110" >> $log_file

        # Clean up mail file
        rm -f /tmp/rubinandraine_nb_ftp.txt

        exit 1

fi

I looked at $log_file. The log also states that
HTML Code:
Script_Error at line [ 202 ]
Code:
+ cat /cerner/w_custom/p5102_cust/code/ksh_logs/rubinandraine_nb_ftp.log
Thu Feb 13 06:00:05 EST 2014
Starting execution of script: rubinandraine_nb_ftp.ksh

FILE SENT - R and R PreCollection NEWBUS file HAS been sent...
===>> Number of encounters in the file -
1

ls -l RANDRPRECOLLECT9225567.out

Copy todays file to /cerner/d_p5102/data/pft_files/pft_precoll_newbus

Rename todays file to yyyymmdd_bmc_precoll_nb.dat
/cerner/d_p5102/ccluserdir/pft_files/pft_precoll_newbus


START messages from FTP:
0<< \INSTREAM
user ftpops #bayciis
cd "pgpfiles"
cd "Rubin-Raine"
binary
put *_bmc_precoll_nb.dat
bye
INSTREAM
Connected to 10.100.124.65 (10.100.124.65).
220 Microsoft FTP Service
331 Password required for ftpops.
230 User ftpops logged in.
250 CWD command successful.
250 CWD command successful.
200 Type set to I.
local: 20140213_bmc_precoll_nb.dat remote: 20140213_bmc_precoll_nb.dat
227 Entering Passive Mode (10,100,124,65,9,171).
125 Data connection already open; Transfer starting.
226 Transfer complete.
4780 bytes sent in 6.2e-05 secs (7.5e+04 Kbytes/sec)
221
END messages from FTP:

Delete file from the original location...
/cerner/d_p5102/ccluserdir/pft_files/pft_precoll_newbus

Script_Error at line [ 202 ]
Program Completed...

I am confused if the error indicate
HTML Code:
grep Script_Error $log_file
is the issue, which I don't think it is. If not, what would the possible cause?
Smilie

Please advise.
# 2  
Old 02-14-2014
Try using
Code:
 grep 'Script_Error' $log_file

# 3  
Old 02-14-2014
You need to check the script which creates this log file. The grep command is fine, it is searching for that string and is displaying.

--ahamed
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Odd and even date in bash

Hi All, I'm having the following script: #!/bin/bash date=$(date +%d) echo $date if ; then echo 'date is even' else echo 'date is odd' (4 Replies)
Discussion started by: zarere
4 Replies

2. Solaris

Odd vi error

Hello, I have a weird think going on, on one of my servers. vi filename "/var/tmp" No such file or directory What going on here? (4 Replies)
Discussion started by: bitlord
4 Replies

3. Shell Programming and Scripting

print ODD lines

i want to print ODD lines like first ,third then fifth and so on 234,567,ABC,KJL 234,565,ABD,KJL 234,568,ABE,KJL 234,560,ABF,KJL 234,563,ABG,KJL 234,562,ABH,KJL O/P will be like 234,567,ABC,KJL ----->first liine 234,568,ABE,KJL ----->third line 234,563,ABG,KJL ----->fifth line... (6 Replies)
Discussion started by: aaysa123
6 Replies

4. UNIX for Dummies Questions & Answers

Finding the odd one out!

Hi guys, I wondered if someone would be able to help me. I have a number of files which all have entries in them looking something like; And I'm looking for a way where by I can compare a number of these files and identify the odd numbers in the sequence. So for example if I had to... (1 Reply)
Discussion started by: JayC89
1 Replies

5. HP-UX

Odd storage behavior

Hi, We have some troubles with our HP server (rx4640) running HP-UX 11.31. The server is attached to a JBod cabinet. If the JBod cabinet is powered on and we power on the server after then HP-UX can't find the devices (disks) at the cabinet. Does not help to run an ioscan -fnC disk. But if I power... (3 Replies)
Discussion started by: hoff
3 Replies

6. UNIX for Dummies Questions & Answers

even odd script

I need a unix script that check for even or odd. EXAMPLE:::: please enter the number to check: 12 the output: This is an even number it has to have prompts. (2 Replies)
Discussion started by: snyper2k2
2 Replies

7. UNIX for Dummies Questions & Answers

Odd file with no name

OS: Solaris 2.6 File with no name created Mar of 2000 - ls (with or without options) shows the file but no name associated with it. Example: ls -ltca -rw-r--r-- 1 root other 9721 Apr 16 2003 printcap -rw-r--r-- 1 root other 267 Apr 16 2003 -rw-r--r-- 1 root other 258 Apr 16... (3 Replies)
Discussion started by: RTM
3 Replies
Login or Register to Ask a Question