Cron wait on dynaminc trigger file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Cron wait on dynaminc trigger file
# 1  
Old 12-30-2008
Cron wait on dynaminc trigger file

I have to schedule a script in cron that watch for a trigger file named as xyz_extract_file_20081201.null (the YYYYMMDD portion would change every day). The wait/wakeup time would be 1 min and the date portion will always be current date (Eg., the trigger file named as xyz_extract_file_20081201.null will be watched on 20081201). The timeout must happen after 8 hours. Could you please help me with a shell script?
# 2  
Old 12-30-2008
Quote:
Originally Posted by shekharaj
I have to schedule a script in cron that watch for a trigger file named as xyz_extract_file_20081201.null (the YYYYMMDD portion would change every day). The wait/wakeup time would be 1 min and the date portion will always be current date (Eg., the trigger file named as xyz_extract_file_20081201.null will be watched on 20081201). The timeout must happen after 8 hours. Could you please help me with a shell script?

Code:
date=$( date +%Y%m%d )
n=0
max=480
while :
do
  sleep 60 & pid=$!
  if [ -f "xyz_extract_file_$date.null" ]
  then
     echo "I'm awake!"
  fi
  n=$(( $n + 1 ))
  [ $n -eq $max ] && break
  wait "$pid"
done

# 3  
Old 12-30-2008
Thanks cfajohnson!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Pick file and Trigger informatica process

Hi, I am creating a script in which we will check a folder. If any file placed inside the folder, script will move the file to another folder and Trigger etl process. Now the issue is that the script should continously check the presence of file inside folder after every minute or hour. So how... (1 Reply)
Discussion started by: dgargd2524
1 Replies

2. Shell Programming and Scripting

Check presence of trigger file

Hi, I make a sftp connection successfully.My requirement is the script shall execute only after i find a trigger file(dailyreport.OK.psv) in the remote dir. If the trigger file is not present ,the script should exit else it should continue with the rest of the scripts statements. Below code is... (13 Replies)
Discussion started by: samrat dutta
13 Replies

3. Shell Programming and Scripting

Create a trigger file using touch

Hi, I need to create a trigger file named "start" at 4 pm daily . Once this file is created , another process would be initiated. How do i do it using touch command in unix ? My script that should have touch command shall be present in a dir /app/user/script while the trigger file should be... (2 Replies)
Discussion started by: samrat dutta
2 Replies

4. UNIX for Dummies Questions & Answers

Match the amount fields in the source file vs trigger file

Hello, I have to write a script to compare the sum of the amount fields in a source file and the amount field in another file. details are: based on the name of the source file (say SALES as an example), a file already available in a path will be grabbed (say SALES_ParmFile) and this file... (4 Replies)
Discussion started by: vijaylak
4 Replies

5. Shell Programming and Scripting

Update trigger for unix file (solaris)

Hello, from log error file of process that i's updating in append mode, i need to capture the new entries for every day. How i can know and save only the new errors? This it's a sample of error log file (oas report server engine) thanks and regards Fran (2 Replies)
Discussion started by: fran61
2 Replies

6. Shell Programming and Scripting

Make cron wait for the child process

I am trying to find a list of files and writing it to a text file. Based on the machine performance the file writing will be slow at certain time. The code to find file and redirecting the output to text file is on a shell script /usr/bin/find $SEARCH_DIR -daystart \( \( -name 'KI*' -a... (4 Replies)
Discussion started by: nuthalapati
4 Replies

7. Shell Programming and Scripting

How to trigger a script based on another log file.

I need to execute my script as soon as one log file arrives. This log file is named as logyymmdd. I need to add trigger to my script based on this logfile. Please guide. (1 Reply)
Discussion started by: nishigupta
1 Replies

8. Shell Programming and Scripting

wait command - cat it wait for not-chile process?

Did not use 'wait' yet. How I understand by now the wait works only for child processes, started background. Is there any other way to watch completion of any, not related process (at least, a process, owned by the same user?) I need to start a background process, witch will be waiting... (2 Replies)
Discussion started by: alex_5161
2 Replies

9. Shell Programming and Scripting

Need to execute 2 scripts, wait, execute 2 more wait, till end of file

:cool: I need to execute a shell script to do the following: cat a file run two back ground processes using the first two values from the file wait till those background processes finish run two more background processes using the next two values from the file wait till those background... (1 Reply)
Discussion started by: halo98
1 Replies

10. UNIX for Dummies Questions & Answers

How to send a trigger file from Unix to Windows

I need to send a file from a Unix box to a Windows sever to kick off a Crystal Reports job. Any good ideas how to do this? Can it be done with FTP? (0 Replies)
Discussion started by: robw95
0 Replies
Login or Register to Ask a Question