keithinsac
Programmer
Hello,
I'm having a problem with a script that uses the Perl::Copy mod to copy a file from the local host to a network share. From local to local the copy works just fine (ie c:\dir\file.txt to e:\dir\file.txt), but when copying from local to a UNC, it continues to fail. The UNC share is a win 2k3 server that currently has everyone full control share and NTFS permissions. The script is run by a windows service that is run under the local system account. I have been trying with both perl copy and additionally trying using the perl system command to use the OS's copy. Interactively (stub testing logged on) the script runs fine, but when a windows service kicks off the script it fails. Below is the code and following is the output. Please help....
Code:
print LOG "\n\n === Tripwire Integration Start ===";
my($tw_host) = "\\\\myserver\\Teamsite_Incoming\\";
my($ts_log_file) = $deploylistfile; --> defined earlier in the script and set to a valid file like "e:\\mylocaldir\\localfile.txt"
print LOG "\nTripwire Incoming Host: $tw_host";
print LOG "\nTeamsite Log File: $ts_log_file";
if (-f $ts_log_file) {
print LOG "\n - file exists: OK";
# strip the path off $ts_log_file and copy the file to new location
my($file) = basename($ts_log_file);
print LOG "\n - file: $file";
my($ext) = extension($ts_log_file);
print LOG "\n - extension: $ext";
print LOG "\n - from: $ts_log_file";
print LOG "\n - to: $tw_host";
if($ext eq "tmp") {
# PERL COPY ------------------------------------------------
$cpresult = copy($ts_log_file,$tw_host.$file);
print LOG "\n perl copy result: $?:$! | cpresult: $cpresult";
# ----------------------------------------------------------
# SYSTEM HOST COPY -----------------------------------------
my @comargs = ('COPY', $ts_log_file, $tw_host.$file);
$cpresult = system(@comargs);
print LOG "\n system @comargs result: $?:$! | cpresult: $cpresult";
# ----------------------------------------------------------
} else {
print LOG "file passed is not a TeamSite log file ('$ts_log_file')";
}
print LOG "\n === Tripwire Integration End ===\n\n";
Output:
=== Tripwire Integration Start ===
Tripwire Incoming Host: \\myserver\TeamSite_Incoming\
Teamsite Log File: e:\Interwoven\OpenDeployNG\tmp\wft_trip_stg_deploy_438540.tmp
- file exists: OK
- file: wft_trip_stg_deploy_438540.tmp
- extension: tmp
- from: e:\Interwoven\OpenDeployNG\tmp\wft_trip_stg_deploy_438540.tmp
- to: \\myserver\TeamSite_Incoming\
perl copy result: 0:No such file or directory | cpresult:
system COPY e:\Interwoven\OpenDeployNG\tmp\wft_trip_stg_deploy_438540.tmp \\myserver\TeamSite_Incoming\wft_trip_stg_deploy_438540.tmp result: 256:No such file or directory | cpresult: 256
=== Tripwire Integration End ===
I don't understand why the error is reported as 'No such file or directory' when interactively, it works just fine. Shouldn't I get a permission error...? Any help is greatly appreciated.
Thank you, Keith
I'm having a problem with a script that uses the Perl::Copy mod to copy a file from the local host to a network share. From local to local the copy works just fine (ie c:\dir\file.txt to e:\dir\file.txt), but when copying from local to a UNC, it continues to fail. The UNC share is a win 2k3 server that currently has everyone full control share and NTFS permissions. The script is run by a windows service that is run under the local system account. I have been trying with both perl copy and additionally trying using the perl system command to use the OS's copy. Interactively (stub testing logged on) the script runs fine, but when a windows service kicks off the script it fails. Below is the code and following is the output. Please help....
Code:
print LOG "\n\n === Tripwire Integration Start ===";
my($tw_host) = "\\\\myserver\\Teamsite_Incoming\\";
my($ts_log_file) = $deploylistfile; --> defined earlier in the script and set to a valid file like "e:\\mylocaldir\\localfile.txt"
print LOG "\nTripwire Incoming Host: $tw_host";
print LOG "\nTeamsite Log File: $ts_log_file";
if (-f $ts_log_file) {
print LOG "\n - file exists: OK";
# strip the path off $ts_log_file and copy the file to new location
my($file) = basename($ts_log_file);
print LOG "\n - file: $file";
my($ext) = extension($ts_log_file);
print LOG "\n - extension: $ext";
print LOG "\n - from: $ts_log_file";
print LOG "\n - to: $tw_host";
if($ext eq "tmp") {
# PERL COPY ------------------------------------------------
$cpresult = copy($ts_log_file,$tw_host.$file);
print LOG "\n perl copy result: $?:$! | cpresult: $cpresult";
# ----------------------------------------------------------
# SYSTEM HOST COPY -----------------------------------------
my @comargs = ('COPY', $ts_log_file, $tw_host.$file);
$cpresult = system(@comargs);
print LOG "\n system @comargs result: $?:$! | cpresult: $cpresult";
# ----------------------------------------------------------
} else {
print LOG "file passed is not a TeamSite log file ('$ts_log_file')";
}
print LOG "\n === Tripwire Integration End ===\n\n";
Output:
=== Tripwire Integration Start ===
Tripwire Incoming Host: \\myserver\TeamSite_Incoming\
Teamsite Log File: e:\Interwoven\OpenDeployNG\tmp\wft_trip_stg_deploy_438540.tmp
- file exists: OK
- file: wft_trip_stg_deploy_438540.tmp
- extension: tmp
- from: e:\Interwoven\OpenDeployNG\tmp\wft_trip_stg_deploy_438540.tmp
- to: \\myserver\TeamSite_Incoming\
perl copy result: 0:No such file or directory | cpresult:
system COPY e:\Interwoven\OpenDeployNG\tmp\wft_trip_stg_deploy_438540.tmp \\myserver\TeamSite_Incoming\wft_trip_stg_deploy_438540.tmp result: 256:No such file or directory | cpresult: 256
=== Tripwire Integration End ===
I don't understand why the error is reported as 'No such file or directory' when interactively, it works just fine. Shouldn't I get a permission error...? Any help is greatly appreciated.
Thank you, Keith