I have a script in Perl which runs on a Unix server (Solaris to be precise). The script uses ftp utility to condition files in a mainframe server and then transfer them to Unix server.
Recently, I am trying to develop a Windows desktop application using Windows forms and C#. I am trying to use the SSH.NET library available from codeplex. The problem is, whenever I run a normal Unix command from the application it works, but when I try to run the script it does not work. I have checked the connection and the application is properly connecting to the server. I have used both the below methods but no luck :-
using (ssh client = new SshClient("Ip", "username", "password"))
{
client.Connect();
SshCommand cmd = client.RunCommand("script");
client.Disconnect();
}
using (ssh client = new SshClient("hostnameOrIp", "username", "password"))
{
client.Connect();
SshCommand cmd = client.createCommand("script");
cmd.execute();
client.Disconnect();
}
It would be a huge help if somebody points me towards a proper direction.
EDIT :- Running the script with the full path has worked as the non interactive shell that is invoked doesn't read the /etc/profile/ env variables when it loads. I will try out the other options suggested as well and edit the post if something works.