1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2011
    Rep Power

    Help required - Urgent - How to code WaitforFile in Use

    Hi All,

    I have a Production Install day after tomorrow and I am in a critical issue.

    I have a LINUX Wrapper Script which is being called 3 times ( from Autosys job) at the same time. This script generates a Parameter file with the same name.The script is trying to create/overrite the same parameter file 3 times & due to this, the ETL process which is trying to read this parameter file is fetching incorrect values.

    Is there a way we can specify in the script that

    1) If the Parameter file is in use by the Wrapper through the first instance,wait until it is read/write before the 2nd instance start accessing.

    I know I need to make some major code changes, but due to the time constraints, I am looking for a workaround.

    Any thoughts will be of great help.

  2. #2
  3. Contributing User
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2006
    Rep Power
    A quick and dirty way would be to use/test a flag file:

    while [ -f /tmp/ETL_in_use ]
      sleep 3
    touch /tmp/ETL_in_use
    # do work
    rm /tmp/ETL_in_use
    The moon on the one hand, the dawn on the other:
    The moon is my sister, the dawn is my brother.
    The moon on my left and the dawn on my right.
    My brother, good morning: my sister, good night.
    -- Hilaire Belloc

IMN logo majestic logo threadwatch logo seochat tools logo