I've got a script that opens a telnet session, does some stuff and then closes the session.
At certain points in the script things can happen or not happen that will trip an error flag.
At the end if the error flag variable is false, meaning the script did not encounter any problems, the log file is deleted using a system command. This part works.
But if the error flag is true, I'd like to rename the file and this part doesn't work.
If I run it from the command line, it works, but when the web server runs it, the renaming part doesn't work even if I hard-code the error flag. The web server is part of the group for the directories involved and both directories are set to 770 permissions. The log files that are created have the web server username as both owner and group.
Here's the pertinent part of the code:
if ($errFlag==1){
#I tried this a couple of different ways, but it does not rename the file
# system("mv $dlog $derr"
;
# system("mv $ilog $ierr"
;
`cp $dlog $derr`;
`cp $ilog $ierr`;
} else {
#This part works. The files are deleted if $errFlag is 0
`rm $dlog`;
`rm $ilog`;
}
Any ideas?
_________
Rott Paws
...It's not a bug. It's an undocumented feature!!!
At certain points in the script things can happen or not happen that will trip an error flag.
At the end if the error flag variable is false, meaning the script did not encounter any problems, the log file is deleted using a system command. This part works.
But if the error flag is true, I'd like to rename the file and this part doesn't work.
If I run it from the command line, it works, but when the web server runs it, the renaming part doesn't work even if I hard-code the error flag. The web server is part of the group for the directories involved and both directories are set to 770 permissions. The log files that are created have the web server username as both owner and group.
Here's the pertinent part of the code:
if ($errFlag==1){
#I tried this a couple of different ways, but it does not rename the file
# system("mv $dlog $derr"
# system("mv $ilog $ierr"
`cp $dlog $derr`;
`cp $ilog $ierr`;
} else {
#This part works. The files are deleted if $errFlag is 0
`rm $dlog`;
`rm $ilog`;
}
Any ideas?
_________
Rott Paws
...It's not a bug. It's an undocumented feature!!!