ColdFusion Muse

Cfexecute: Upgrading from Coldfusion 6.1 to Coldfusion 8

Mark Kruger January 28, 2008 9:43 AM Coldfusion 8, Coldfusion Troubleshooting Comments (0)

Here's a tricky little bug that I missed during a recent upgrade. The customer had Coldfusion 6.1 and we were tasked with moving them to Coldfusion 8. After reviewing the code and determining that no changes would be necessary, we did the upgrade. After we were finished everything seemed fine except one obscure task that was set up to run periodically. It was a command line task using Cfexecute. The task accessed the mysqlump.exe file to create periodic backups of the mysql database. The code (which was working on CF 6.1) looked like this:

<cfexecute
    name="#pathvar#/mysqldump.exe --opt #var1# --user=#var2# --password=#var3#"
    outputFile="#var4#"
    timeout="120">

</cfexecute>
Now I'm not a huge fan of cfexecute. I usually find some other way to run command line programs. But I have seen code exactly like this work before so I did not think to check the syntax. After the upgrade we began to get a "file not found" type of error. We looked at file permissions. We changed the path to remove spaces. We even tried the Joliet style path and name (as in c:\progra~1\....) but to no avail. Our customer, a Coldfusion programmer in his own right, was looking through the docs and noticed that the "arguments" attribute was a part of the docs but missing in our previously working example. He changed the code to look like this:
<cfexecute
    name="#pathvar#/mysqldump.exe"
    arguments="--opt #var1# --user=#var2# --password=#var3#"
    outputFile="#var4#"
    timeout="120">

</cfexecute>
...sure enough it started working.

So if you are troubleshooting Cfexecute after an upgrade to 7 or 8 and you are getting missing file exceptions and scratching your head. Check to see if you are using the old style Cfexecute syntax where the executable and the arguments are all on the same line and passed in the "name" argument. If you are, take the "arguments" portion of the command line and move them to the "arguments" attribute of the cfexecute tag. That might do the trick.

  • Share:

0 Comments