need to execute a script remotely

Discussion in 'OT Technology' started by johnnywallywallace, Nov 10, 2003.

  1. as though the host the script resides on is calling it.

    I have a bulkload XML import procedure that I need to call ON the DB server FROM the webserver, and it needs to execute as though the DB server were calling it, but the originating events are on the web server.

    SQL Server 2000 & Windows Adv Server 2000 with IIS

    thoughts?
     
  2. 5Gen_Prelude

    5Gen_Prelude There might not be an "I" in the word "Team", but

    Joined:
    Mar 14, 2000
    Messages:
    14,519
    Likes Received:
    1
    Location:
    Vancouver, BC, CANADA
    WHy not use the scheduler?

    AT \\DBServer "c:\importproc.bat"

    check the AT command for more details...
     
  3. what documentation I've googled so far is unclear ... this will execute AS the remote host?
     
  4. NolanTA

    NolanTA You talkin' to me? OT Supporter

    Joined:
    Oct 9, 2002
    Messages:
    2,397
    Likes Received:
    0
    Location:
    Dallas
    Once it's added to the scheduler, you can change the user context for the task to run in (in control panel/task scheduled), but I believe if created by AT it runs under the system account.
     
  5. but it's not a matter of users, it's a matter of the MACHINE itself.
     
  6. 5Gen_Prelude

    5Gen_Prelude There might not be an "I" in the word "Team", but

    Joined:
    Mar 14, 2000
    Messages:
    14,519
    Likes Received:
    1
    Location:
    Vancouver, BC, CANADA
    I'm not sure what you mean by that - even the machine has a user account (SYSTEM) which is what everything is permissioned off of. There would be no difference between running the AT command without a computername from your dbserver, as a command given by the webserver to RUN on the dbserver.

    You need to play with this idea first, see if you can get the functionality to work, then worry about the details later. Make yourself a directory on the DBserver called Batchdir or something like that, make a batch file that writes a simple file:

    echo test > c:\batchdir\test.txt
    exit

    save that as c:\batchdir\runtest.bat and launch it with the scheduler - does it write the file? Yes? Delete the file test.txt and try running:

    AT \\DBServer c:\batchdir\runtest.bat from the webserver - does it run? From there you just have to adapt the application to your needs. But play around with a simple batchfile to start - you can worry about your import process later.

    EDIT: Within the AT command, refer to the command you want to run with the UNC name - ie \\dbserver\batchdir\runtest.bat. It will have to be a share.
     
    Last edited: Nov 12, 2003
  7. see it all comes back to the fact that I need to execute a remote script on a remote machine AS the remote machine when an event occurs on the local server. I don't think any of the above is revelant, from the sounds of things, but thanks.
     
  8. 5Gen_Prelude

    5Gen_Prelude There might not be an "I" in the word "Team", but

    Joined:
    Mar 14, 2000
    Messages:
    14,519
    Likes Received:
    1
    Location:
    Vancouver, BC, CANADA
    I think all of the above is relevant. I think you need to be more specific on why this won't work because it meets all of your requirements. Think of the scheduler on the remote computer as just sitting there with a list of things to do (even a blank list). All you're doing is adding to the list of things to do - it doesn't care where it got the information from.

    I mean if it wasn't for the scheduler, an old school way which I still use is to simply have a batch file running on the remote computer constantly looking for a file to show up in some designated directory. When that file is found, it deletes it, and continues executing its script. When it's done, it restarts itself waiting for the file to show up again.

    Either way will work, and will execute as if you did it manually from the dbserver. The only way this won't work is if you can't execute your import proccess directly from a command line command - if it has a gui, you're screwed.
     

Share This Page