Hi, How do I code my servlet such that it can call a script ( Korn, Perl etc) on another Unix box (e.g. dsn123) ? I guess that i'd need to be using Runtime.getRuntime().exec ?? .... Runtime.getRuntime().exec(" ../host/home/third/script.pl") cheers
Is it possible to call a script on another UNIX box from the one which the Servlet is running? I thought security violations were where you're attempting to connect with another box from an applet. I am not sure whether Servlet disallows my requirement. If so that is a shame - for me - but what if the script existed on the same machine or called a script on the same machine which then pointed at another script on another machine ???
Servlets are given a high level of trust, and I believe there are people in this forum who have successfully used the exec() function in servlets. In order to run a script that lives on another machine, you obviously must have access to the interpreter, its runtimes, and the script, so you need an NFS connection just to be able to see the script, and a perl interpreter system needs to be available on the web host. Implicit execution of Perl isn't going to work - the "#!/usr/bin/perl" part is handled by the shell, and you're not using the shell. So you need to explicitly SAY exec("/usr/bin/perl ../host/home/third/script.pl"); Just as a general reminder - if you synchronously invoke a long-running process of any type, you may timeout on the user's browser and can have performance problems on the webserver. It's often best to make a server for the external process and play web games with it as an a synchronous service.
An IDE is no substitute for an Intelligent Developer.