Sponsored Content
Top Forums Shell Programming and Scripting Script needed to wait for existence of multiple files Post 302472539 by pchang on Wednesday 17th of November 2010 11:22:01 AM
Old 11-17-2010
Script needed to wait for existence of multiple files

Hi Forum.

I need a script to wait for all multiple trigger files to be present or else go to sleep for 10 seconds (Number of trigger files can vary). I tried to search on the forum but was not able to find a solution.

I found this code on this forum but it's not working as expected:
Code:
for i in `cat ${TMP_TRG_FILE}`  -- where TMP_TRG_FILE contains trigger files trg1.txt trg2.txt trg3.txt
do

   if [ -e "$i" ]
   then
       echo "File Exists"
       break
   else
       sleep 10
   fi
 
done

- for loop stops after a number of iterations instead of going to sleep and waiting for the missing trigger files.

Any help is greatly appreciated.

Thanks
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

verifying existence of multiple files

Hi, I have unix script on solaris 5.10. I have to verify existence of 3 files in path and sleep for 1 hour. I have tried for 1 file: if then echo " File is found!" sleep 3600 echo "time delayed" fi Please advice (6 Replies)
Discussion started by: ammu
6 Replies

2. Shell Programming and Scripting

Help Needed : Split one big file to multiple files

Hi friends, I have data in flat file as following, first filed is the customer number. We have almost 50-100 customers in the system 100 ABC A123 100 BVC D234 100 BNC N324 200 CBC A122 200 AVC D294 200 HNC N324 300 GBC A173 300 FVC D234 300 DNC N344 I want to split the file and... (5 Replies)
Discussion started by: monicasgupta
5 Replies

3. Shell Programming and Scripting

Checking Multiple file existence

Hi, I want to check multiple files exist or not in a single if statement in korn Shell:confused:. Please help me Thanks (1 Reply)
Discussion started by: lathish
1 Replies

4. Shell Programming and Scripting

Complex Search/Replace Multiple Files Script Needed

I have a rather complicated search and replace I need to do among several dozen files and over a hundred occurrences. My site is written in PHP and throughout the old code, you will find things like die("Operation Aborted due to....."); For my new design skins for the site, I need to get... (2 Replies)
Discussion started by: UCCCC
2 Replies

5. Shell Programming and Scripting

bash script for testing existence of files/folders and creating if neither exist

Hi, I am new to shell-scripting, and doing a lot of reading. I am having some trouble getting started with a simple testing of scripting. I have been experimenting with if, loops, for, test, etc., but still unsure. I seem to have the hang of it when it comes to creating a single file or... (6 Replies)
Discussion started by: me2
6 Replies

6. Shell Programming and Scripting

replace multiple existence of : symbol with one

Infile Outfile (3 Replies)
Discussion started by: dvah
3 Replies

7. Shell Programming and Scripting

calling a shell script in background and wait using "wait" in while loop

Hi, I am facing a strange issue, when i call a script from my while loop in background it doesnt go in background, despite the wait i put below the whil loop it goes forward even before the process put in background is completed. cat abc.txt | while read -u4 line do #if line contains #... (2 Replies)
Discussion started by: mihirvora16
2 Replies

8. UNIX for Dummies Questions & Answers

Run one script on multiple files and print out multiple files.

How can I run the following command on multiple files and print out the corresponding multiple files. perl script.pl genome.gff 1.txt > 1.gff However, there are multiples files of 1.txt, from 1----100.txt Thank you so much. No duplicate posting! Continue here. (0 Replies)
Discussion started by: grace_shen
0 Replies

9. Shell Programming and Scripting

[Solved] Help with shell Script ,wait for some files for some time??

Hi All, I have the requirement that ,i have to write a shell script that job has to wait for a 7 touch files created by another application for 4 hours, if i get all 7 touch files ,i have to send a mail that i jobs are completed, if if it is waiting for more than 4 hours i have to send a mail... (2 Replies)
Discussion started by: Pradeep Shetty
2 Replies

10. Shell Programming and Scripting

Script to check the files existence inside a directory.

Hello Folks, On Below Script, I want to apply condition. Condition that it check the directory for files if not found keep checking. Once directory have files and founded do the calculation and finish the code. Script to check the files existence inside a directory, If not then keep... (16 Replies)
Discussion started by: sadique.manzar
16 Replies
deb-triggers(5) 						  dpkg utilities						   deb-triggers(5)

NAME
deb-triggers - package triggers SYNOPSIS
triggers DESCRIPTION
A package declares its relationship to some trigger(s) by including a triggers file in its control archive (i.e. DEBIAN/triggers during package creation). This file contains directives, one per line. Leading and trailing whitespace and everything after the first # on any line will be trimmed, and empty lines will be ignored. The trigger control directives currently supported are: interest trigger-name Specifies that the package is interested in the named trigger. All triggers in which a package is interested must be listed using this directive in the triggers control file. activate trigger-name Arranges that changes to this package's state will activate the specified trigger. The trigger will be activated at the start of the following operations: unpack, configure, remove (including for the benefit of a conflicting package), purge and deconfigure. If this package disappears during the unpacking of another package the trigger will be activated when the disappearance is noted towards the end of the unpack. Trigger processing, and transition from triggers-awaited to installed, does not cause activations. In the case of unpack, triggers mentioned in both the old and new versions of the package will be activated. Unknown directives are an error which will prevent installation of the package. SEE ALSO
dpkg-trigger(1), dpkg(1), /usr/share/doc/dpkg-dev/triggers.txt.gz. Debian Project 2009-03-15 deb-triggers(5)
All times are GMT -4. The time now is 06:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy