[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 356
  • Last Modified:

get error in my shell script

Hi experts

in my shell script i have this line : dosql " update txout_820 set flag821 = 'H' where edifname= '04050055.23'"
i want to update my database.
when i run the script through cron i got this error message :-23101 Unable to load locale categories.
and i checked the database and it wasnt updated.

i couldnt find why dosql is not runnig and how to fix it ? what that error message is about?

when i comment dosql in my script , the error message didnt show up .

could you please help me with that? i appreciate any help. i need to fix this for my co-op job.

sorry if i post my question in wrong category.

thanks
Far22

this is my script:

#!/bin/sh
# This script will copy Bell Canada EDI file to AS2 server
############################

#####
export DBPATH=/swdbase/database
export DBTEMP=/swdbase/tmp
export PATH=/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/informix/bin:/usr2/reporting/bin:/usr2/reporting/cvs-bprpt/script:/usr4/edi/edi_script
#####
THELOG=/usr2/logfile/edi_trans.log
BIN=/usr4/edi/edi_script
mm=` date +%m`
dd=` date +%d`
#viewfile=/usr4/edi/edi_as2_ready/vf

echo "------------------------------------------------------" >> $THELOG
echo "`date +%m/%d/%y-%H:%M:%S` : edi autosend.as2 starting -----" >> $THELOG
echo "  sending Bell Canada file to AS2 server " >> $THELOG
cd /usr4/edi/edi_as2_ready

echo $mm$dd

for edi_as2 in `ls`
do
       echo $edi_as2
                   echo " `date ` - starting duplicate check" >> $THELOG

        bellcdn=`$BIN/viewedi < $edi_as2 |grep 'BELLOACCTREC' |wc -l`

                        echo " size: $bellcdn "
        if (test $bellcdn -gt 0) then

                                                $BIN/autosend_edi_duplicate_check.pl $edi_as2 >> $THELOG
                                                result=$?

                                                case "$result" in
                                                            0)
                                                                  echo "$edi_as2 is NOT duplicated"
                                                                  scp $edi_as2 esp@172.17.68.216:/var/usr4/faran/scp_as2_file/ ### lexicom@clxp01as2.cucbc.com:/opt/lexicom/outbox/Bell/
                                                                  echo "The following file sent out:" >> $THELOG
                                                                  echo $edi_as2 >> $THELOG
                                                                  #mv $edi_as2 /usr4/edi/edi_backup/ > /dev/null 2>&1

                                                                  echo "update txout_820" >>$THELOG
                                                                  dosql " update txout_820 set flag821 = 'H' where edifname= '04050055.23'"      
                                                                  ;;
                                                            1)
                                                                  echo "$edi_as2 is duplicated"
                                                                  sendmon 1 " autosend.as2----$edi_as2 is duplicated,  Please check"
                                                ##### mv $edi_as2 $EDIDIR/edi_hold
                                                #####      cp $edi_as2 $EDIDIR/edi_hold            
                                                                  echo $edi_as2 "has been moved to edi_hold "
                                                                  echo "------------------------------------" >> $THELOG
                                                                  echo "update txout_820" >>$THELOG
                                                              dosql " update txout_820 set flag821 = 'N' where flag821 = 'C' and edifname = '$edi_as2' "
                                                                  ;;            
                                                            2)
                                                                  echo "not a 820 file"
                                                                  echo "not 820 file"  >> $THELOG

                                                #####       scp $edi_as2 esp@172.17.68.216:/var/usr4/faran/scp_as2_file/   ### lexicom@clxp01as2.cucbc.com:/opt/lexicom/outbox/Bell/

                                                ##### mv $edi_as2 /usr4/edi/edi_backup/ > /dev/null 2>&1
                                                #####      cp mv $edi_as2 /usr4/edi/edi_backup/ > /dev/null 2>&1            
                                                                  ;;
                                                            3)
                                                                  echo "no record found in database" ;;

                                          esac

                                          echo "result : $result"
                    else
           echo "No file to send." >> $THELOG
        fi
done  
echo "`date +%m/%d/%y-%H:%M:%S` : edi autosend.as2 ended -----" >> $THELOG
echo "------------------------------------------------------" >> $THELOG

exit 0

0
Far22
Asked:
Far22
  • 4
  • 3
  • 2
  • +2
1 Solution
 
Gabriel OrozcoSolution ArchitectCommented:
this problem has happend with informix and scripts running from crontabs

may be you need to add at the top of your crontab:

. /etc/profile

so you can add all provile variables. But you may need only the locale variables:
http://www.iiug.org/forums/classics/index.cgi/read/1293
0
 
Far22Author Commented:
thanks for your response

i look at the link but i didnt get it what should i do to fix this.  i didnt understand the answer.sorry i'm new in that.

i understand this is a setting environment variable problem but i dont know how to fix this.
also, how can i add /etc/profile to the cron table?
i mean what is the syntax?
should i just put /etc/profile as the first line of the cron table? or should i put it before the line has my script?

is there a way i can fix it in my script instead of the cron table?

thanks a lot for your help.
Far22
0
 
Gabriel OrozcoSolution ArchitectCommented:
sorry, change "crontab" for "script" instead:

may be you need to add at the top of your script:

. /etc/profile

but first be sure you have an /etc/profile =)
0
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 
sumpiCommented:
if it runs with your user, you might do something like
env
and have a look at your environment-settings (pretty close to what was mentioned above)
just export any environment-variable
e.g. if env displays a var like
SHELL=/bin/bash
then you can try
export SHELL=/bin/bash
and so on. Another possibility for you to use would be to trigger the command as the correct user.
this would be something like:
su - <username> -c /path/to/your/script
So cron would change to your UID and trigger the script with your environment...

hth,
Sumpi
0
 
root_startCommented:
Hi Far22,

Check the following link: http://www.cisco.com/univercd/cc/td/doc/product/wanbu/nmt/nmt15/nmtycet.htm

It seems that one environment variable is not set or is not set correctly: INFORMIXDIR

Try, in your script to export this variable:
=============================================
export INFORMIXDIR=<path to informix dir>
=============================================

Sometimes the "<path to informix dir>" can be "/usr/users/informix"

I hope it helps you. =0)
0
 
Far22Author Commented:
thanks a lot. it is working now.

i wish experts in bluethoot category were like you.

thanks a loooooooooooooooooooooooooot
Far22
0
 
Gabriel OrozcoSolution ArchitectCommented:
Venabili: Please re-review the question as the user found an answer.

I think you would want to give the points to root_start perhaps
0
 
VenabiliCommented:
Did you read my message? Had I said that the solution is not found?
0
 
Gabriel OrozcoSolution ArchitectCommented:
I think I overlooked your message. On other previous emails I got you were already given recommendation so I think it was because of that

my apologies =)
0
 
VenabiliCommented:
I give them when I am sure what to do. When I am not after the third reading, I just ask the experts to help me make the decision :)

It is ok :)

Venabili
0
 
Far22Author Commented:
hi experts

sorry i didnt check this email for a while for some reasons. i accepted the answer and it helped me to solve my problem.i thought it's clear from my last submission. thanks for your help again.
0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

  • 4
  • 3
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now