Sponsored Content
Top Forums UNIX for Advanced & Expert Users Help with UNIX "File Open" Error Post 302919616 by randybrazil on Thursday 2nd of October 2014 03:21:21 PM
Old 10-02-2014
Help with UNIX "File Open" Error

I am sorry, i shuold have posted the whole script. I am new to the forum. Thanks for all the insight and help so far. Here is the script.

sfdomain2 /u20/apps/arms/scripts (RM01) :cat process_auth.ksh
#!/bin/ksh
Code:
 
#################################################################
#
# File Name: process_auth.ksh
#
# Function: Calls load_auth.ksh for all located auth files
#
# $Revision: 1.3 $
#
#################################################################
JOB="process_auth"
USAGE="USAGE:  process_auth.ksh {YYYYMMDD} {BANK MPS|NOVA}"
#execute .profile to get environment
. $HOME/.app_profile
fail_notify()
{
   cat $OUTF | mailx -s "FAIL: $JOB " `cat $APP_BASE/secured/failDB.mail`
   cat $OUTF > $APP_BASE/trigger/$JOB.error
   exit 1
}
#PHJ - CO 3094: failDB.mail includes Madhu and Sharma Pandyaram in the failure notification list.
if [ $# != 2 ]
then
  echo $USAGE
else
BANK=$2
cdate=$1
OUTF=$APP_BASE/log/$JOB.$BANK.log.`date '+%Y%m%d%H%M'`

#begin log block
{
if ls $APP_BASE/trigger | grep error > /dev/null
then 
  echo ">>>   Error trigger file exists"
  fail_notify;
fi
echo "`date +'%m-%d-%Y %H:%M:%S'` truncating S_AUTH table" 
sqlplus -S / << EOF
truncate table app_stratus.s_auth reuse storage;
--delete from app_stratus.s_auth;
--commit;
EOF
#build list of authorization files for parameter date
cd $IRM_INCOMING/auth
########## NOVA BANK FILE PROCESSING ##############
if [ $BANK = "NOVA" ] 
then
for i in `ls *${cdate}*`
do
# call load script with date and filename to process
  if echo $i | grep usb > /dev/null
  then
   echo "BYPASSING USB AUTH FILES - USBANK FILE, NOT NOVA"
  else
    if echo $i | grep stratus > /dev/null
    then
     echo "BYPASSING STRATUS TRANSFER LOG FILES"
    else
     if [ `fuser $i 2>&1 | awk '{ printf "%s",$2 }' | wc -c` -eq 0 ]
     then
       #FILE IS CLOSED
       echo "--------------------------------------------------------------------"
       # record attributes; dup check
       echo "`date +'%m-%d-%Y %H:%M:%S'` recording file attributes $i"
       FILEATTR=`$IRM_HOME/scripts/record_file_attr_new.ksh $IRM_INCOMING/auth $i  grep RESULT | cut -f2 -d"|"`
       if [ $? -eq 0 ] 
       then
         echo "`date +'%m-%d-%Y %H:%M:%S'` CALL load_auth.ksh $1 $i"
         cp  $IRM_INCOMING/auth/$i  $IRM_INCOMING/auth/s_auth.dat
         chmod a+r $IRM_INCOMING/auth/s_auth.dat
         sqlplus -S / << EOF
exec app_stratus.pkg_load_stratus.load_auth(to_date('$1','YYYYMMDD'),'${i}');
EOF

#         $IRM_HOME/scripts/load_auth.ksh $1 $i
         echo "`date +'%m-%d-%Y %H:%M:%S'` MOVE $i to archive directory"
         mv $IRM_INCOMING/auth/$i $IRM_ARCHIVE/auth/$i
       else
         echo "`date +'%m-%d-%Y %H:%M:%S'` $i possible duplicate file, marking as duplicate; bypassing load"
         mv $i $i.duplicate
         compress $i.duplicate
         mv $i.duplicate.Z $IRM_ARCHIVE/auth
       fi   #FILEATTR=0
     else
       #log error because file is open
       banner "* ERROR *"
       echo "`date +'%m-%d-%Y %H:%M:%S'` ERROR $i file is open"
       fail_notify;
     fi  #is file open
   fi #STRATUS_TRANSFER_LOG
 fi #USBfilename
 
done
fi #BANK

########## USB/MPS BANK FILE PROCESSING ##############
#
# get all USB files regardless of date string within filename
# parameter filedate is used for settlement date
#
if [ $BANK = "MPS" ] 
then
for i in `ls usb*`
do
  
     if [ `fuser $i 2>&1 | awk '{ printf "%s",$2 }' | wc -c` -eq 0 ]
     then
       #FILE IS CLOSED
       echo "--------------------------------------------------------------------"
       # record attributes; dup check
       echo "`date +'%m-%d-%Y %H:%M:%S'` recording file attributes $i"
       FILEATTR=`$IRM_HOME/scripts/record_file_attr_new.ksh $IRM_INCOMING/auth $i | grep RESULT | awk '{ print $2 }'`
       if [ $? -eq 0 ] 
       then
         echo "`date +'%m-%d-%Y %H:%M:%S'` CALL load_auth.ksh $1 $i"
#         $IRM_HOME/scripts/load_auth.ksh $1 $i
         echo "`date +'%m-%d-%Y %H:%M:%S'` MOVE $i to archive directory"
         cp  $IRM_INCOMING/auth/$i  $IRM_INCOMING/auth/s_auth.dat
         chmod a+r $IRM_INCOMING/auth/s_auth.dat
         sqlplus -S / << EOF
exec app_stratus.pkg_load_stratus.load_auth(to_date('$1','YYYYMMDD'),'${i}');
EOF
         
         
         
         mv $IRM_INCOMING/auth/$i $IRM_ARCHIVE/auth/$i
       else
         echo "`date +'%m-%d-%Y %H:%M:%S'` $i possible duplicate file, marking as duplicate; bypassing load"
         mv $i $i.duplicate
         compress $i.duplicate
         mv $i.duplicate.Z $IRM_ARCHIVE/auth
       fi   #FILEATTR=0
     else
       #log error because file is open
       banner "* ERROR *"
       echo "`date +'%m-%d-%Y %H:%M:%S'` ERROR $i file is open"
       fail_notify;
     fi
   
done
fi #BANK = MPS

# Do a call to app_stratus.pkg_load_stratus.auth(to_date('$1','YYYYMMDD'));
echo "`date +'%m-%d-%Y %H:%M:%S'` CALL PL/SQL: PKG_LOAD_STRATUS.LOAD_AUTH($1)" 
sqlplus -S / << EOF
exec app_stratus.pkg_load_stratus.auth(to_date('$1','YYYYMMDD'));
EOF
#Check return code for error
status=$?
echo "`date +'%m-%d-%Y %H:%M:%S'` submitting background file compression at archive site" 
} >> $OUTF
if [ $status -ne 0 ]
then
  fail_notify;
else
  echo $1 > $APP_BASE/trigger/$JOB.$BANK
fi  #STATUS
if [ $BANK = "MPS" ] 
then
compress $IRM_ARCHIVE/auth/usb*.4 &
else
compress $IRM_ARCHIVE/auth/*$1* &
fi
fi #usage
exit

 

9 More Discussions You Might Find Interesting

1. Solaris

A NEW version of "boot: cannot open kernel/sparcv9/unix "

Ok, I found this article: https://www.unix.com/sun-solaris/19665-boot-cannot-open-kernel-sparcv9-unix.html However it doesn't quite describe my situation. I have created a jumpstart DVD that works great, and installs my customized Solaris-10 (Yes 10, not 8 or 9 per previous posts) . It... (6 Replies)
Discussion started by: biea
6 Replies

2. SuSE

VMDB Failure" followed by "Unable to open snapshot file"

keep getting an error when I try to revert to a snapshot: "VMDB Failure" followed by "Unable to open snapshot file" Im using vmware server 1.0.4, host OS is windows xp and guest OS is SLES. Is there anything I can do to recover the snapshot or am I in trouble!?!?! (0 Replies)
Discussion started by: s_linux
0 Replies

3. Solaris

Solaris 10 - Unable to boot the system "panic: cannot open /kernel/amd64/unix"

Hi All, I have installed Solaris 10 on my AMD 64 3000+ system. I was playing with grub commands eeprom and bootadm commands. I screwed my boot-file and now am unable to boot the system. Gets error msg as "panic: cannot open /kernel/amd64/unix". I booted the system is filesafe and tried update the... (2 Replies)
Discussion started by: Manjunath K V
2 Replies

4. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

5. SCO

sco unix backward compatibility on "max open file per process"

Hi How to increase maximum number of open file in "sco xenix binary" running in "sco unix openserver 5.0.7" ? I have changed "NOFILES" kernel parameter to 512, but xenix binray can't open more than 60. tnx (4 Replies)
Discussion started by: javad1_maroofi
4 Replies

6. UNIX for Dummies Questions & Answers

Unix "look" Command "File too large" Error Message

I am trying to find lines in a text file larger than 3 Gb that start with a given string. My command looks like this: $ look "string" "/home/patrick/filename.txt" However, this gives me the following message: "look: /home/patrick/filename.txt: File too large" So, I have two... (14 Replies)
Discussion started by: shishong
14 Replies

7. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

8. Shell Programming and Scripting

Expect: spawn id exp5 not open while executing "expect "$" { send "sudo su -\r" }"

Hi All, i am trying to ssh to a remote machine and execute certain command to remote machine through script. i am able to ssh but after its getting hung at the promt and after pressing ctrl +d i am gettin the out put as expect: spawn id exp5 not open while executing "expect "$" {... (3 Replies)
Discussion started by: Siddharth shivh
3 Replies

9. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies
All times are GMT -4. The time now is 12:25 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy