3 Replies Latest reply: Apr 4, 2013 6:58 AM by Srini VEERAVALLI RSS

    Need help with Sudo command in Unix script

    user4039570
      Hi There,
      I have an etl job, with source as csv files.
      My source team drops files at a location. I have an unix script, that moves these files to my source file directory. And loads these files one at a time.

      When my source team does not send a file, my job fails.
      So i want to put a dummy file, at a location where my src team drops files, when src team does not send a file.
      it says donot have privilege, so I did a sudo still it is giving error below;
      ----------------------------------------
      sudo su - etltest
      cd /d11/OBISTG/obidata1/cos/ --- src team drops file here

      filecount=`ls -lt AR_DATAMART_COS* | wc -l`

      if [[ $filecount -eq 0 ]]; then
      echo 'AR_DATAMART_COS.Dummy.99990101.000000.csv' > NavisionfileList.txt
      fi

      ls AR_DATAMART_COS* >>NavisionfileList.txt
      -------------------------------------

      Error:
      sudo su - etltest
      + sudo su - etltest
      sudo: sorry, you must have a tty to run sudo

      any ideas pls?

      Thanks,
      Rag
        • 1. Re: Need help with Sudo command in Unix script
          Srini VEERAVALLI
          When my source team does not send a file, my job fails
          Instead of shell script you may go for EventWait object from Workflow Manager, this keeps wait for the file and on file existence can run the task.
          In your workflow Start-->EventWait ->Session

          Try it out this.

          If helps mark

          Edited by: Srini VEERAVALLI on Apr 3, 2013 9:51 AM
          • 2. Re: Need help with Sudo command in Unix script
            user4039570
            Hi Srini,
            1. My src team sends a bunch of files with date&time extention.
            My script move them to my src file dir, create a file list for indirect method(informatica) and then process these files.

            According to you, if they put a semaphore file, then I can use event wait task.

            2. We are running Informatica wkfs through DAC.
            If I go by event wait task approach, on a particular day if src team does not send a file: my job will be waiting for the semaphore file.
            In DAC Version we are using, when one job is running, all other jobs will be waiting in a queue.
            To run jobs in parallel, we have to install a DAC patch.

            So the whole idea is: If put a file name in my file list(for inderect method), my job will never fail.
            Any ideas pls?

            Thanks,
            Raghu
            • 3. Re: Need help with Sudo command in Unix script
              Srini VEERAVALLI
              Make sure that any point of time there is a file; by default keep a file with a row can be number columns as 0 and char cols as null etc.
              if the actual file comes in the directory your default file would override and DAC load the file in warehouse and make sure that your informatica workflow creates default file with a row as I said above before it complete.

              You might using SIL mapping with update strategy that would take care of the above record to insert or update.