Executing unix commands in SSIS

  • I need to stop services and then re-start services as part of a process and was wondering what is the best way to run the following commands using SSIS:

    ssh oratst@demprdap1 ./bounce10gAS.sh stop

    ssh oratst@demprdap1 ./bounce10gAS.sh start

    Any assistance would be apreciated. Thanks!!

  • not even familir with unix by any means, but if the commands you pasted can be copied/pasted to a Windows cmd window, which then does the connection to the remote server and runs the commands, the way to do it withing TSQL is fairly easy:

    --ssh oratst@demprdap1 ./bounce10gAS.sh stop

    --ssh oratst@demprdap1 ./bounce10gAS.sh start

    SET NOCOUNT ON

    declare @cmd varchar(500)

    SET @cmd='ssh oratst@demprdap1 ./bounce10gAS.sh stop '

    EXEC master.dbo.xp_cmdshell @cmd

    SET @cmd='ssh oratst@demprdap1 ./bounce10gAS.sh start '

    EXEC master.dbo.xp_cmdshell @cmd

    if those are actual commands that need to be run in the UNIX Shell, I'd wait someone else's suggestions, as you need to get the shell first.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • IF you have an SSH utility you can reference it directly with the Execute Process Task in SSIS. I see no reason to go through xp_cmdshell. You can but if you can do it directly, why not..

    CEWII

  • When I try to run it, I get the following error:

    'ssh' is not recognized as an internal or external command,

    operable program or batch file.

    NULL

    I am assuming that I need to install the SSH Client in order for it to work.

  • If you go to a command prompt and type SSH does it fail? If so then one of two things is true. Either there isn't one (and there usually isn'y by default) or it can't find it.. For the first case install it, for the second either reference it by full path or add it to the system path.

    Also in the Execute Process Task there is an option labeled RequireFullFileName (right at the top) that if it is in the path (and you don't care to include the full path the SSH.EXE) should be set to false.

    Clear?

    CEWII

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply