Even Driven (File triggered) shell script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Even Driven (File triggered) shell script
# 1  
Old 07-01-2010
Question Even Driven (File triggered) shell script

Hi All
I am not an expert at shell programming. But in the process of learning. But I have a requirement it goes as follows :

Requirement 1:
I have a series of files that keep comming on a unix folder every hour. The files names are different. As soon as a file arrives in this folder I will like to kick off a shell script that will validate the file name and call the respective proceedure or a load script to load this file to a database.

Requirement 2:
From a windows server I will like to perform a secured ftp on to a unix folder every hour. There will be 4 parallel sequences of files that would be dumped on to the windows server and will have a corresponding completed trigger file for each sequence.

thanks for reading the above.
Can you please guide me where to start this from and if there are any scripts that i can go thro that will be very useful.

THANKS A TON!! :-)

Regards
Beginner...
# 2  
Old 07-02-2010
when you said files keep coming every hour. So its like they just come all in one go and then for 1 hour .. there is nothing coming in the folder?
# 3  
Old 07-02-2010
the the complete picture is as follows.
There are hourly extract files which are dumped on to a windows shared folder. These set of files have four streams and one trigger (complete) file associated with each stream. Streams come in parallel and nearly the same time (within 5 minuit) window. these have to be "pulled" on to a linux or aix server every hour (so u are right, they come in one go and after 1 hour they arrive again)and as soon as a file lands on unix the corresponding database load module has to trigger (this is to ensure that we load files parallely and save time for a near real time load).
I need some starting points, and some key design aspects that I might have to consider to make the entire solution robust and scaleable.
# 4  
Old 07-05-2010
Your script (unless you go VERY OS specific) will poll the receiving directory looking for a time change (i.e. it has been updated). If you have a good shell "test" available you'll be able to see if a "file" (your dir) is newer than another file (your last timestamp from the last change). Of course, that doesn't tell you if it changed... but for a large directory if the files linger, checking for time change before doing a potentially long check of the actual directory contents is wise (?).

That timestamp file COULD be the last known list of files in some sorted order... thus if the timestamp is now older, use the list found there to compare with the new list of files in the directory and identify the changed files.... then move that new filelist as the timestamp file (avoid modifying the file or time on the file of course)... etc...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Using menu driven script

Hi Team , I wrote a shell script for adding and subtracting two numbers am getting error could some one please help to fix it script: echo "Enter 1 to add:" echo "Enter 2 to sub:" echo "Enter 3 for both addition and subtraction :" read ans; case "$ans" in 1)... (4 Replies)
Discussion started by: knz
4 Replies

2. Shell Programming and Scripting

Menu Driven Bash Shell Script with Default Option

Hi All, I have written a menu driven bash shell script. Current Output is as below: ------------------------------------- Main Menu ------------------------------------- Option 1 Option 2 Option 3 Option 4 Exit ===================================== Enter your... (3 Replies)
Discussion started by: kiran_j
3 Replies

3. Shell Programming and Scripting

Windows exe file fails when triggered from ssh

Hi, I am triggering a windows exe file using the below command. ssh user@remoteserver command.exe -option1:xx /option2:yy This command is working fine from windows command prompt. When I am triggering the same command from ssh I get the error message cant load Any ideas to deal with... (2 Replies)
Discussion started by: ahmedwaseem2000
2 Replies

4. UNIX for Dummies Questions & Answers

Tracking the script(.sh) files triggered on daily or monthly basis from source

Hi Gurus, Is there any solution for tracking the script(.sh) files triggered on daily or monthly basis from source - Datastage (Routines) Needs to find out if this scripts are running on daily just want to know that is there anything to track Thanks in Advance (2 Replies)
Discussion started by: SeenuGuddu
2 Replies

5. Shell Programming and Scripting

Execution Problem with dispalying file content using menu driven script

HI All.. below is my menu options script. in option 2,3 and 4 im giving input and they are saving into their respective text file. problem is when im trying to "cat" those files in options 7,8 and 9 im not getting the output. no respective file contents are displaying on screen. but if i... (1 Reply)
Discussion started by: saichand1985
1 Replies

6. Shell Programming and Scripting

Menu driven script.

I'm a beginner at scripting and have been putting this script together over the past week. It's no where as polish as it could be. Any tips/suggestions on improving this script would be appreciate it. Every week, my team develops WAR files in tomcat on our test environment and moves them to our... (4 Replies)
Discussion started by: bouncer
4 Replies

7. Shell Programming and Scripting

ksh script not working if triggered by scheduler

I have a script that works well if i execute manually using informix user. However, it does not execute properly if triggered using the scheduler (ESP). This is the partial part where it doesn't work. i added some tracing but i can't figure it out. #!/bin/ksh let db_is_up=0... (6 Replies)
Discussion started by: tungaw2004
6 Replies

8. Shell Programming and Scripting

perl script command line option driven script

could someone show me a sample command line option driven script? i want to see an easy way to write one and how i can execute it using command line options such as typing in read.pl -i <id> -c <cmds> -s <start> -e <end> would read out all the commands run by ID . from start time to... (7 Replies)
Discussion started by: kpddong
7 Replies

9. SuSE

Write shell script using menu-driven approach to show various system

QUESTION: Write shell script using menu-driven approach to show various system configuration like 1) Currently logged user and his logname 2) Your current shell 3) Your home directory 4) Your current path setting 5) Your current working directory 6) Show Currently logged number of... (1 Reply)
Discussion started by: bboyjervis
1 Replies

10. Homework & Coursework Questions

Menu Driven Shell Script which accepts1 to 5 options

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: 1) Write a Menu Driven Shell Script which accepts1 to 5 options and performs the following actions for... (1 Reply)
Discussion started by: vaghya
1 Replies
Login or Register to Ask a Question