cfexecute (Linux) arguments escaping bracket calling sql file

245 views
Skip to first unread message

Guillermo

unread,
Aug 20, 2012, 11:05:08 AM8/20/12
to ra...@googlegroups.com
On Linux
 
This works on SSH:
mysql --host=127.0.0.1 --port=3306 --user={myUser} --password={myPass} clientMaster < /usr/share/apache-tomcat-7.0.27/webapps/myApp/mysql/client_master.sql

(file contains restore commands)

This works:

<cfexecute
name="/usr/bin/mysql"
arguments="mysql --host=127.0.0.1 --port=3306 --user={myUser} --password={myPass} execute='CREATE DATABASE newClientDB'"
variable="results"
timeout="60"/>

 

This does not work:

<cfexecute
name="/usr/bin/mysql"
arguments="mysql --host=127.0.0.1 --port=3306 --user={myUser} --password={myPass} newClientDB < /usr/share/apache-tomcat-7.0.27/webapps/myApp/mysql/restoreMasterTables.sql"
variable="results"
timeout="60"/>

 

I have tried everything that I can think of to escape the bracket but the statement wont run.

 

Matt Quackenbush

unread,
Aug 20, 2012, 11:09:59 AM8/20/12
to ra...@googlegroups.com
Have you by chance tried it in cfscript?

http://wiki.getrailo.org/wiki/TAG:CFEXECUTE

HTH

Guillermo

unread,
Aug 20, 2012, 11:31:54 AM8/20/12
to ra...@googlegroups.com
Yes exact same issue.

Matt Quackenbush

unread,
Aug 20, 2012, 11:36:02 AM8/20/12
to ra...@googlegroups.com
In that case, how about opening up a ticket so the team can take a peek?  :-)

https://issues.jboss.org/browse/RAILO

Peter Boughton

unread,
Aug 20, 2012, 12:07:55 PM8/20/12
to ra...@googlegroups.com
I think this is actually expected behaviour - you're passing in arguments, not a shell command.

In the shell, the < is shorthand for changing stdin (standard input) - so it's not an argument for the executable..So when provided via cfexecute's argument attribute it probably makes sense for cfexecute to escape it.

To solve your problem, create a shell script to run the command, and call cfexecute on that script.

However, a useful enhancement to cfexecute might be the addition of a `stdin` attribute?

Matt Quackenbush

unread,
Aug 20, 2012, 12:18:37 PM8/20/12
to ra...@googlegroups.com
Good point, Peter. And excellent suggestion!

Guillermo Cruz

unread,
Aug 20, 2012, 12:19:20 PM8/20/12
to ra...@googlegroups.com
Peter,
 
That is exactly what I was thinking but nothing I could find was telling me it wouldnt be possible. Your right a shell script would be better for now but for some reason I always expect cfexecute to run the shell exactly as I can manually. I hope that it gets added to Railo. I opened a ticket so if you want to close it or put your statement as a workaround.
 
Guillermo
Reply all
Reply to author
Forward
0 new messages