Results 1 to 14 of 14

Thread: problem with a bash script in a job

  1. #1
    Join Date
    Jun 2006
    Posts
    16

    problem with a bash script in a job

    My job consist in the execution of a DTS. During it, I execute this bash script :
    Code:
    echo pays,log,web>"C:\Documents and Settings\pivotaltest\My Documents\webqueue_fr.txt"
    ::parcours du répertoire h:, pour chaque repertoire inscription du nombre de fichier de ce dernier + nom repertoire dans le fichier webqueue_fr.txt
    for /F "usebackq delims=" %%v in (`dir g: /a:d /b`) do (
    dir "g:/%%v" | find ".hsy" /c /i>tmp_fr.txt
    ::/p	attend une réponse de l'utilisateur(le fichier texte pour nous)
    set /p tmp=<tmp_fr.txt
    echo fr,%%v,!tmp!>>"C:\Documents and Settings\pivotaltest\My Documents\webqueue_fr.txt"
    ::/a	attend une expression numérique
    set /a tmp=0
    )
    ::del /s tmp_fr.txt
    It runs well on the dts, but when i do a job, i have the following errors :
    Code:
    The system cannot find the path specified.Could Not Find C:\WINNT\system32\tmp_fr.txt
    I have the feeling, that the txt files are not created, but I don't know why...

    anyone have ideas on this issue ?

  2. #2
    Join Date
    Sep 2002
    Location
    Fantasy
    Posts
    4,254
    replace this statement
    >tmp_fr.txt

    with

    >c:\tmp_fr.txt


    and

    replace this statement

    del /s tmp_fr.txt

    with

    del /s c:\tmp_fr.txt


    replace this statement

    <tmp_fr.txt

    with

    <c:\tmp_fr.txt

  3. #3
    Join Date
    Jun 2006
    Posts
    16
    I have ever try this trick, but this doesn't resolve my issue. In fact, the files are saved in "system32", but i don't know why ?
    Last edited by gatsu; 07-03-2006 at 10:14 AM.

  4. #4
    Join Date
    Sep 2002
    Location
    Fantasy
    Posts
    4,254
    by default command prompt uses c:\windows\system32 as the current
    folder.

  5. #5
    Join Date
    Jun 2006
    Posts
    16
    it's strange, now my files are created on "C:\Program Files\Microsoft SQL Server\80\Tools\Binn" even i specify the path

  6. #6
    Join Date
    Sep 2002
    Posts
    5,938
    You may need add 'cd c:\dir_name' in your script before saving file.

  7. #7
    Join Date
    Jun 2006
    Posts
    16
    finally, i have notice where is the problem :
    [CODE]cd E:\Analyse_synchro_pivotal
    dir "f:/%%v" | find ".hsy" /c /i>"tmpuk.txt"[/CODEE]
    the redirection isn't made.

  8. #8
    Join Date
    Jun 2006
    Posts
    16
    hi,
    After many an many attempts, i have always my problem (the tmpuk.txt file is not created at the command dir)
    i have try to use rigid path, and this is the same thing.
    Anyone can help me please ?

    this is my last version of my bash script :
    Code:
    e:
    cd "Analyse_synchro_pivotal"
    echo pays,log,web>"E:\Analyse_synchro_pivotal\webqueue_uk.txt"
    
    ::parcours du répertoire h:, pour chaque repertoire inscription du nombre de ::fichier de ce dernier + nom repertoire dans le fichier webqueue_uk.txt
    for /F "usebackq delims=" %%v in (`dir J: /a:d /b`) do (
    e:
    cd Analyse_synchro_pivotal
    dir "J:/%%v" | find ".hsy" /c /i>tmpuk.txt
    ::/p	attend une réponse de l'utilisateur(le fichier texte dans notre cas)
    set /p tmp=<"E:\Analyse_synchro_pivotal\tmpuk.txt"
    echo uk,%%v,!tmp!>>"E:\Analyse_synchro_pivotal\webqueue_uk.txt"
    ::/a	attend une expression numérique
    set /a tmp=0
    )
    Last edited by gatsu; 07-20-2006 at 09:36 AM.

  9. #9
    Join Date
    Jun 2006
    Posts
    16
    I see on Google groups that a job is executed by a specific user, anyone can explains me more on this point ?
    thanks

  10. #10
    Join Date
    Sep 2002
    Posts
    5,938
    Who is job owner? If owner is member of sysadmin, the job is run under sql agent service account.

  11. #11
    Join Date
    Jun 2006
    Posts
    16
    the job owner is a member of sysadmin, and it's an windows user with authentification windows. So, what are the permissions of this jobs : those of my job owner, or those of the agent service (how can i see the permissions of it on the different folders ?)

  12. #12
    Join Date
    Sep 2002
    Posts
    5,938
    Then you should check permission of sql agent service account? Start sql agent with domain account if you need access remote files in the job.

  13. #13
    Join Date
    Jun 2006
    Posts
    16
    So the sql agent takes the permissions of the user wich is authentified on the windows session ? but when my job will execute, it will takes the permissions of its owner ?

  14. #14
    Join Date
    Sep 2002
    Posts
    5,938
    Any job owned by member of sysadmin runs under sql agent service account's credential.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •