Sponsored Content
Top Forums Shell Programming and Scripting Check file availability and place flag file Post 302899491 by dhruuv369 on Tuesday 29th of April 2014 01:02:44 PM
Old 04-29-2014
@Don, I tried the script in the following way, but I am stuck in the middle part where I need to check the conditions for each request flag separately. Could you please help me out.

Code:
while [ 2 -ge 1 ]
do

        if [ -f /dir1/dir2/dir3/break.timx ]
        then
                echo "The Script is ending as a request has been made to break the script"
                exit $SUCCESS
        else
        req_file_list=`ls /dir1/dir2/dir3/ReqFiles`
                                echo $req_file_list

                        atleast_one_req_file_processed=0

        for req_file in $req_file_list
        do
                if [ $atleast_one_req_file_processed -eq 0 ]
                then
                        grep $req_file /dir1/dir2/dir3/flags_info.txt > /dir1/dir2/dir3/req_file_current_session.txt
		# /dir1/dir2/dir3/flags_info.txt is a fixed file and has all the information on the request flags and the conditions the script expects and should look on before placing the indicator/flag file. 
                        atleast_one_req_file_processed=`expr $atleast_one_req_file_processed + 1`
                        echo $atleast_one_req_file_processed
                else
                        grep $req_file /dir1/dir2/dir3/flags_info.txt >> /dir1/dir2/dir3/req_file_current_session.txt
                fi

        done
Stuck at this part, as I am not sure how to check conditions for each request file separately 
		sleep 300
        fi
done

Example of the /dir1/dir2/dir3/flags_info.txt is given below:

Code:
cat /dir1/dir2/dir3/flags_info.txt

request_flags|source_name|job_name|file_pattern|file_count|indicator_flag_file
req1.req|Sourcename1|jobname1|file_pattern_1|3|ind1.ind
req2.req|Sourcename2|jobname2|file_pattern_2|6|ind2.ind
req2.req|Sourcename2|jobname2|file_pattern_A|3|ind2.ind
req3.req|Sourcename3|jobname3|file_pattern_3|1|ind3.ind
req3.req|Sourcename3|jobname3|file_pattern_Z|1|ind3.ind
req4.req|Sourcename4|jobname4|file_pattern_4|28|ind4.ind
req5.req|Sourcename5|jobname5|file_pattern_5|4|ind5.ind


Last edited by dhruuv369; 04-29-2014 at 02:18 PM.. Reason: Pattern file improvement
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

insert file 1 at a specific place of file 2

Hello, I need to search in file2 for class A : public B { and insert right after that the content of file1. I am a bit lost as to which tools (which bash functions, awk...). I should use. Thanks for some directions here. Regards (1 Reply)
Discussion started by: JCR
1 Replies

2. Shell Programming and Scripting

Shell to run one after another checking any flag or file

a.ksh & b.ksh run at the same time and takes huge resource and time.I want to put a technique so that one wil run after another. eg put a flag so that each script will check if it running , then sleep and wait it to finish. Can some one advise (3 Replies)
Discussion started by: konark
3 Replies

3. Solaris

Check Database availability?

Hi All, My script gets aborted as it is connecting as a remote database through a DB link on every 3rd sunday.As the remote DB is down for more than 6 hours. Can TNSPING DBNAME inside my script ensure the database is up??? Then how can i check the database is up or down ? ... (2 Replies)
Discussion started by: megh
2 Replies

4. Shell Programming and Scripting

using flag inside a for loop to check condition

I have a logic like this It initializes the flag variable as "T" at the beginning of the loop everytime Inside each loop it checks for two conditions and updates the flag variable as "A" or "B" In the end of the loop it checks for the value of the variable flag for "A" or "B" and execute... (4 Replies)
Discussion started by: codeman007
4 Replies

5. Programming

Some how the open(file,flag, acc) returns 0 and write to the screen, instead of the file ???

I am out of idea what to do to resolve the problem! I need to use the open(file, for.., access) function to write a file. Never have the situation like that: it is return 0 - zero. As a result all write(..) going to the screen! What the problem it could be? I do not even know... (2 Replies)
Discussion started by: alex_5161
2 Replies

6. Shell Programming and Scripting

how to check availability of data of one file in other

hi all i have two files in unix 1.table.name 2.all.tables i need to check the availability of all data of table.name in all.tables.both the table contains n number of data.i need a script which will check one by one whether the data exist in table.name or not.I want this in SH. (1 Reply)
Discussion started by: alisha
1 Replies

7. Shell Programming and Scripting

Read from file specific place in file using inode

Hello, I am using tcsh on AIX. I would like to write a script that does the following: 1. given an inode, how do I find exactly the name of the file? I know I could do this using ls -i | grep <inode> but it returns: <inode> <filename>. I need some string manipulation or something to... (1 Reply)
Discussion started by: lastZenMaster
1 Replies

8. Shell Programming and Scripting

Check File availability

Hi, I have a task to write a script , which will run everyday to check whether my system has received 2 files from source system. It should mail me ( using mailx preferably ) if the files has not arrived from the source. The scenario is everyday I get 2 files from source system.,... (3 Replies)
Discussion started by: cratercrabs
3 Replies

9. UNIX for Dummies Questions & Answers

For loop to check the files availability

Hi, I need a help with my script. Below is my script. What I am doing here is finding the date of the file which I need to process and then finding the list of file names. Based on the list of file names, check has to be done to see if all the files are there and log the details to a error... (3 Replies)
Discussion started by: Vijay81
3 Replies

10. Shell Programming and Scripting

Search for a file in all directories and place the file in that directory

Hi All, Daily I am getting the updated file. I have to search for this file in all directories and sub directories. If the file existed in a particular directory then move this updated file to that particular directory. If the file is not existed in any of the directories then place this... (4 Replies)
Discussion started by: ROCK_PLSQL
4 Replies
DH_INSTALLDEBCONF(1)						     Debhelper						      DH_INSTALLDEBCONF(1)

NAME
dh_installdebconf - install files used by debconf in package build directories SYNOPSIS
dh_installdebconf [debhelperoptions] [-n] [--params] DESCRIPTION
dh_installdebconf is a debhelper program that is responsible for installing files used by debconf into package build directories. It also automatically generates the postrm commands needed to interface with debconf. The commands are added to the maintainer scripts by dh_installdeb. See dh_installdeb(1) for an explanation of how that works. Note that if you use debconf, your package probably needs to depend on it (it will be added to ${misc:Depends} by this program). Note that for your config script to be called by dpkg, your postinst needs to source debconf's confmodule. dh_installdebconf does not install this statement into the postinst automatically as it is too hard to do it right. FILES
debian/package.config This is the debconf config script, and is installed into the DEBIAN directory in the package build directory. Inside the script, the token #DEBHELPER# is replaced with shell script snippets generated by other debhelper commands. debian/package.templates This is the debconf templates file, and is installed into the DEBIAN directory in the package build directory. debian/po/ If this directory is present, this program will automatically use po2debconf(1) to generate merged templates files that include the translations from there. For this to work, your package should build-depend on po-debconf. OPTIONS
-n, --no-scripts Do not modify postrm script. -- params Pass the params to po2debconf. SEE ALSO
debhelper(7) This program is a part of debhelper. AUTHOR
Joey Hess <joeyh@debian.org> 11.1.6ubuntu2 2018-05-10 DH_INSTALLDEBCONF(1)
All times are GMT -4. The time now is 04:22 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy