Unix/Linux Go Back    

Shell Programming and Scripting BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

Help needed for Sleep (File watcher)

Shell Programming and Scripting

sleep, solved, wait

Thread Tools Search this Thread Display Modes
Old Unix and Linux 05-15-2017   -   Original Discussion by ace_friends22
ace_friends22 ace_friends22 is offline
Registered User
Join Date: Sep 2010
Last Activity: 15 May 2017, 11:39 AM EDT
Posts: 24
Thanks: 0
Thanked 1 Time in 1 Post
Help needed for Sleep (File watcher)

Hi All,

I have a requirement, where I need to check for file. If file is not available then wait for 5 minutes and if it still not available, fail the process. It should check every one minute.

If File available in between, should start remaining process. Now my problem is, I have both part ready. But not able to understand where to put script logic, if file is available.

Ex: Wait for file, for 5 minutes, check every one minute

let tw=0
let num=60

while [ ! -f /home/aa.txt ]; do
sleep 60
tw=`expr ${tw} + ${num}`
if [ ${tw} -eq 300 ]
echo "Time exceed 5 minutes"
exit 1;
echo "Waiting for file, wait time exceeds ${tw}"

Now, if file aa.txt is available at beginning or in between above , then I need to start working on it. I do not know where to keep that portion. Can somebody help me?

---------- Post updated at 09:09 PM ---------- Previous update was at 08:59 PM ----------

Sorry, I found solution. I have posted solution for same in 2008. Linux

Apologize for this.

Sponsored Links

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Looking out for the file-watcher tush Shell Programming and Scripting 4 02-01-2013 08:19 AM
Help needed with File Watcher script stunnerz_84 Shell Programming and Scripting 2 07-28-2011 08:06 PM
File Watcher Help !! westernmichnov Shell Programming and Scripting 2 06-22-2011 08:50 AM
File Watcher using autosys rajasilpa Shell Programming and Scripting 0 04-05-2010 01:59 PM
File Watcher er_zeeshan05 Shell Programming and Scripting 3 12-27-2008 06:37 AM

All times are GMT -4. The time now is 06:37 AM.