narainhere has asked for the wisdom of the Perl Monks concerning the following question:

Hie monks, I am writing a CGI script(hosted on a windows box in tomcat) which should do two things

1.require a file residing on a unix machine

I know about the FTP module but Unfortunately I am not permitted to do that


2.Based on the contents of the required file, it should execute some scripts which reside on the same unix box.

Net::SSH would work from unix-to-unix It seems, is that so?? Does windows have a ssh equivalent


Yelp out a fellow monk!

The world is so big for any individual to conquer

  • Comment on Executing a script on unix box from windows

Replies are listed 'Best First'.
Re: Executing a script on unix box from windows
by bart (Canon) on Dec 03, 2007 at 12:52 UTC
    I hope you realize the difference between using FTP to get a module to execute, and actually executing it on the other server.

    Anyway... maybe you could use good old CGI? Provided the Unix server has a webserver running, then all you need to do is load a particular URL, under which your script could run. That does mean moving all your script intelligence into the server script.

Re: Executing a script on unix box from windows
by jrsimmon (Hermit) on Dec 03, 2007 at 12:51 UTC
    I haven't used this before, but Net::SSH::W32Perl would seem to be what you're looking for.
Re: Executing a script on unix box from windows
by KurtSchwind (Chaplain) on Dec 03, 2007 at 14:26 UTC

    I'm a little confused here. Are you trying to 'execute' a remote command? If so, then you can do that with SSH.

    If you are trying to require a file that resides on a remote box, that happens to be unix, that's entirely different. However, there IS ssh for windows as someone has pointed out. (BTW: You can also download putty if you just wanted a pure ssh client).

    --
    I used to drive a Heisenbergmobile, but every time I looked at the speedometer, I got lost.
Re: Executing a script on unix box from windows
by graff (Chancellor) on Dec 04, 2007 at 02:09 UTC
    You are in an area where it is worth asking questions like: "Is this really necessary? Might there be some better/easier/more effective way of doing whatever it is that really needs to be done?" And for that, the basic question is "What is it, exactly, that needs to be done?"

    Given that the remote unix box has the "required" file and the processing scripts needed for accomplishing some part of your task, what parts of the task need to be done by the windows machine (or the windows user)? To put it differently, what stands in the way of writing a script on the unix machine to do everything, leaving the windows machine entirely out of the process?

    If there is data on the windows machine that needs to be folded into the processing, focus on getting that data copied to the unix box, and have a script on the unix box to put everything together.

    If some human has to manually inspect data that comes from the unix machine, make some decisions that only a human can do, and then convey those decisions back to the unix machine to finish the process, it would be better to use ssh directly (e.g. via putty), If a GUI is needed, write a perl script using Tk or Wx to create a straight windows app. Doing that sort of job control via CGI would be a last resort, IMHO.