Divakar has asked for the wisdom of the Perl Monks concerning the following question:
Trying to execute perl script in remote machine via rsh.
it is working fine in the machine where the script present. but if i tried to execute from my machine, it is reporting invalid argument while trying to open the file and it dies.
sub set_tslaunch_env { my $env_file = shift; chomp($env_file); print "\n\nfile is $env_file\n"; if (-f $env_file) { print "\nfile is there\n"; } if (open ENV_FILE, $env_file) { print "\nfile is opened\n"; close(ENV_FILE); print "\nfile is closed\n"; exit; while(<ENV_FILE>) { chomp; my @values = split(/=/, $_); if (grep (m"^$values[0]$", @allowable_env_vars)) { my $old_val = $values[1]; my $share_name = $config->{local_nt_drive}; $share_name =~ s/://g; $values[1] =~ s/$config->{local_nt_drive}/\\\\${local_ +machine}\\$share_name/g; if ($values[0] eq 'PATH') { $values[1] = $ENV{PATH} . ';' . $values[1]; } print "env var $values[0] has been set to: $values[1]. + prev value was: $old_val\n"; $ENV{$values[0]}=$values[1]; } } close ENV_FILE; } else { die "Unable to open file $env_file in order to read the env se +ttings: $!\n"; } } my $debug_dir=$ARGV[0]; set_tslaunch_env("$debug_dir\\tslaunch_tsd3_retail_connected_env.log") +;
output from the machine where the script presents
C:\>C:\Perl64\bin\perl.exe c:\remote.pl \\ostorenas\odi\ostore_platfor +m_logs\ost ore\7.4.0\test1\winnt64_vc100_win2012_dotnet\2013-10-24-0433\debug_log +s file is \\ostorenas\odi\ostore_platform_logs\ostore\7.4.0\test1\winnt6 +4_vc100_wi n2012_dotnet\2013-10-24-0433\debug_logs\tslaunch_tsd3_retail_connected +_env.log file is there file is opened file is closed
output from my machine
C:\Users\test1.OBJECTSTORE>rsh osw2k12vc10-c2 C:\Perl64\bin\perl.exe c +:\remote.p l \\ostorenas\odi\ostore_platform_logs\ostore\7.4.0\test1\winnt64_vc10 +0_win2012_ dotnet\2013-10-24-0433\debug_logs Unable to open file \\ostorenas\odi\ostore_platform_logs\ostore\7.4.0\ +test1\winn t64_vc100_win2012_dotnet\2013-10-24-0433\debug_logs\tslaunch_tsd3_reta +il_connect ed_env.log in order to read the env settings: Invalid argument file is \\ostorenas\odi\ostore_platform_logs\ostore\7.4.0\test1\winnt6 +4_vc100_wi n2012_dotnet\2013-10-24-0433\debug_logs\tslaunch_tsd3_retail_connected +_env.log
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Invalid Argument while opening a file.
by QM (Parson) on Oct 24, 2013 at 13:41 UTC |