Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CFEXECUTE PROBLEM UNDER CFMX

Status
Not open for further replies.

cfFran

Programmer
May 30, 2002
64
US
We just switched to CFMX about 2 weeks ago. We run an automatic backup of our source code files every night using the CF Scheduler. The scheduler invokes a CF module that uses CFEXECUTE to run the command line version of WinZip, which creates an archive file of the source code in a given subdirectory. This has been running successfully for at least 2 years under previous versions of CF. Now it won't run anymore.

Test Findings:
(1) I have tested winZip from the MS Dos Prompt. It works.
(2) When I put the same command arguments into a CFEXECUTE tag in a test CFM, it does not work.
(3) There is a file created (0 byte size). This file cannot be deleted because of a 'sharing violation.'
(4) If I cycle the CFMX Application Server service (STOP/START), the zipfile is created.

Any ideas on how to make this work without my intervention?
 
I think the clues are 3 and 4.

Since you get a "sharing violation" when you try to open it, that suggests that ColdFusion is still working on creating the file (it thinks)... so CFEXECUTE is initiating the launch of WinZip. And since the file is, indeed, created when you bounce the server, that suggests that ColdFusion just doesn't know when WinZip is finished.

Have you tried setting a timeout on the CFEXECUTE tag?





-Carl
 
Hmmmm... I just had a look at my version of WinZip... and it reports that it doesn't support a command-line interface (the CLI module is in beta testing at the moment).

What version of WinZip are you using?



-Carl
 
With Regard to the version of WinZip...We run 8.1.
The version of Winzip Command Line is shown in the error message given below:

WinZip(R) Command Line Support Add-On Version 1.0 (Build 3181)
Copyright (c) WinZip Computing, Inc. 1991-2000 - All Rights Reserved
Error: File not found or no read/write permission or sharing problem (c:\temp\myZipFile.zip)
 
With regard to the timeout value: I had accepted the default of zero seconds. (ColdFusion does not wait for the spawned task to finish)

At your suggeston I tried using delays from 10 to 60 seconds for the timeout. The error message said that the "timeout period expired without completion of c:\progra~1\winzip\wzzip.exe" the first time I ran it. After that, unless I STOP/START the service, it says "File not found or no read/write permission or sharing problem (c:\temp\myZipFile.zip)"

It seems like winzip starts to make the file and never unlocks it.
 
> It seems like winzip starts to make the file and never unlocks it.

Seems that way. Actually... it seems like WinZip is never completing the archiving, for some reason. I've gotta believe it has more to do with the WinZip Command-Line Add-on then it does CFEXECUTE.

Perhaps one reason WinZip never exits is it's attempting to throw up an error message that needs user intervention to discard.

Is there a "suppress error messages" and/or "run silently" switch? The only one I see in the beta version is "-yb[c]". Are you using that?




-Carl
 
I am having the same sort of problem with cfexecute. At the moment I am experimenting with PHP to see if i can get it to do what I want using php's exec function. at the moment it is working quite well, but would like to resolve the problem with cfexecute.

I thought it was something to do with the executable i was using but you seem to be having the same problem that I am having!

if it helps this is the php code that i am using to exec my exe file:

exec("search_generator.bat");

this exec's the search_generator.bat file that is in the same directory as my php file

If i manage to find anything else I'll be sure to post it!

Hope this helps!

Tony
 
I am not using a switch to suppress error messages. However, I have run this CFM while sitting at the server's console several times. There is no error message that comes up on the server's monitor screen.

At this point anything is worth a try. Let me give it a shot... I put in switches of "-a -ybc" and it made no difference.

My boss has always preached "check what you changed last". The only changes have been the version of CFAS and the web server. The new server is running Apache Web Server 2.39 rather than Netscape Suitespot 3.51. I checked the date stamp on wzzip.exe. They are identical on the two servers. The source code has not changed.
 
I do remember Tony brought up his problem last week. It doesn't sound identical, but similar enough where it might be worth a call to MM to see if it's a known issue.

Or has anyone checked the website to see if it's listed on any bug reports?



-Carl
 
Just been having a look around on the MM CF forum, and found someone having a problem with CFExecute, in the same way that I am experiencing. I have tried this and it doesn't help with my situation, but it might help with cfFran's problem.

The post talks about using cfimpersonate, not this is not available in MX as it has been left out of MX. Now the solution involves logging on as an authenticated user instead of the IUSR login - that most web servers are setup with as default - do what you want to do and then logoff as that user and continue as before.
<!--- start of code --->
<cflogin>
<cfloginuser name=&quot;user_name&quot; password=&quot;password&quot; roles=&quot;admin&quot;>
</cflogin>

do you cfexecute here

<cflogout>
<!--- end of code --->

Now like i said this didn't fix my problem, but you never know it might fix yours

Hope this helps!

Tony
 
The WinZip support folks say they have no experience with ColdFusion and WinZip. However, Nick Sweeting of WinZip Computing suggested using the -b[drive|path] option of wzzip.exe to change the subdirectory where the temporary file is created. His theory is that perhaps ColdFusion has some special file handling set up for the subdirectory I am using.

Sorry to say it did not help. I was able to make the temporary file in &quot;C:\temp&quot; and &quot;D:\&quot; but it was locked, could not be erased, and winzip never finished making the zip file until I stop/started the CFMX Application Server service.

It sure seems like ColdFusion MX and wzzip.exe are having conflicts of some kind.

-Fran
 
Ok guys and girls: here's the workaround:
As I stated above wzzip.exe cannot seem to finish its work unless ColdFusion MX gets out of its way. So I wrote a batch file that I called cycle.bat (actually, I think Allaire used to distribute a batch file like this). In it I put the

net stop &quot;ColdFusion MX Application Server&quot;
net start &quot;ColdFusion MX Application Server&quot;

commands to stop-start the NT service for ColdFusion. In my CFM that runs the multiple requests to back up each subdirectory in our system, I included the CFEXECUTE tag to run this batch file at the very end of the CFM.

<!--- Notice that a space in the apache web server directory path requires double quotation marks in
ColdFusion. That requires that I escape the double quotes to make ColdFusion happy --->
<CFEXECUTE NAME=&quot;c:\winnt\system32\cmd.exe&quot;
ARGUMENTS=&quot;/c &quot;&quot;d:\program files\apache group\apache2\htdocs\myProjects\cycle.bat&quot;&quot;&quot;
>
</CFEXECUTE>

Not a very satisfying solution, but it works. Moving on...
 
Won't this also kill any sessions and applications (or, more importantly, session variables and application variables) for all users across the whole site?

That not only sounds like not a very satisfying solution... but a rather dangerous and inconvenient one at that (if you're using sessions for anything).


-Carl
 
Good Point, Carl. If a ColdFusion developer is using application variables or session variables this workaround is going to produce new problems. In my particular case, unless these variables are being created automatically by ColdFusion, I am skating by on this one. So far I have not noticed any problem with the application of this workaround.

Believe me I would much prefer that MacroMedia's developers attacked this CFEXECUTE problem. Until someone comes up with a good solution, I am stuck with this one.
 
has anyone figured out a better way around this &quot;problem&quot; with cf and winzip?
 
Hi,

I had a similar problem when I was moving my Jetform Central server software from Windows NT to Windows 2000. I had a task defined that runs an FTP batch file which FTP's a PostScript file containing the final PostScript output of a form merged with a data overlay file back to my mainframe for printing.

In the batch file, I create an FTP command file then I execute the default command line FTP client and log onto my mainframe, passing my FTP command file (created each time to include whatever file name that is used with each overlay file to be used to create the PS filename) to the FTP client.

On the WINNT system, it worked fine, but on the WIN2000 system, the merge job step would complete, a PostScript file would appear in my Output directory and a locked FTP command file would appear in my Control directory. The file transfer would never take place.

I would then have to reboot the server to reset everything and unlock the FTP command file which could then be deleted. (Jetform Central 5.3 uses a JFCONTROL.EXE service to control three other processes that run in the background and cannot be ended in the task manager.) (Hind site being 20/20, I could have looked for and ended the FTP process.)[smile]

I set the controller service not to start at boot time, rebooted and then ran the FTP batch file within a command window to see what was going on.

The FTP operation would execute but stop on the FTP command line waiting for another instruction. I HAD TO ADD A QUIT COMMAND TO MY LIST OF FTP COMMANDS THAT I WAS PASSING TO FTP IN ORDER FOR IT TO COMPLETE PROPERLY !!!!! With Windows NT, I didn't need to include the QUIT command.

Nice one, Microsoft !!!!! [thumbsdown]


John Trembly
mailto:John.Trembly@dpcdsb.org
 
Well, you could blame Microsoft but you'd also have to place half the blame on yourself. Exiting the command line FTP program gracefully, i.e. using QUIT, should've been part of your batch file from the beginning.

I know what you are saying, though. Apparently the FTP program doesn't release control of the file unless you exit.

This reminds me of people not destroying instances of COM objects in ASP after they are done with them.

-Tek
 
I am having the same problem with CFEXECUTE -- it starts my .exe but never closes it if I don't have a TIMEOUT set. If I do set a TIMEOUT I get an error saying that it didn't finish before it timed out. If I just run the .exe without ColdFusion, I have no problems an it finishes within a few seconds. Someone mentioned that it should be fixed in Updater 3, but it hasn't. I read somewhere about CFX_EXECUTE. Has anyone used that?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top