Search code examples
javashellautosys

Autosys File watcher


My Task : Need to look for any new/updated files in particular directory of Server A. Once a file new/modified file is present on this directoty, I will need to ftp that file to Server B.

Can I do this with Autosys and shell scripts ? or will a Java program be more appropriate for this task ?

If I go with Autosys, I can setup a file watcher job. On success I can trigger another job. But how will this job know the file name ? Is file watcher smart enough to pass the file name as parameter to another job ?

Please help....


Solution

  • The file watcher job is for checking the existence of a file and checking the size of it. You have to know the name of the file in advance. In your case if you can receive any number of new files whose names you don't know beforehand, the file watcher job is not going to work.

    One plausible solution can be:

    1. Write a shell script that will
      • Get ls -l of the directory you are watching and save it to a file
      • Compare this file with the file generated from the last run of the script
      • Find out the new files and the files that were changed and ftp them to the destination
    2. Schedule the script in autosys to run periodically, say every 10 mins.