• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

CFEXECUTE to run a Perl script not returning anything

Explorer ,
Dec 06, 2007 Dec 06, 2007

Copy link to clipboard

Copied

I'm trying something like:
<CFEXECUTE NAME="/var/www/cgi-bin/something.pl" TIMEOUT="60"/>
but there is no output. This works from the command line and from the browser (running CFHTTP is not a great substitute here).

I've read on the forums that this could be a permission issue, but I'm not getting an error. The documentation for CFEXECUTE says "If the effective user of the ColdFusion executing thread does not have permissions to execute the process: a security exception." So why no exception? FYI, I'm running ColdFusion 7 on Linux.

I know that CFEXECUTE by itself works because this tag works and returns the date/time: <CFEXECUTE NAME="date" TIMEOUT="60"/>

If ColdFusion does need to have different permissions and/or run as a different user in order to run a Perl script, how do you set this up? And is this a big security issue if it's on a public web server?

Thanks for any input.
TOPICS
Advanced techniques

Views

3.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Dec 07, 2007 Dec 07, 2007

Copy link to clipboard

Copied

Grant,

I've executed perl on a Windows server by putting the perl executable itself as the name, and the script name as the first argument. May or may not address your issue, but could be worth a try...

James

<cfexecute name="C:\Perl\bin\perl.exe" timeout="60"
arguments="#ExpandPath('script.pl')# #otherArgs#"/>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 07, 2007 Dec 07, 2007

Copy link to clipboard

Copied

Thanks, but that didn't work either. It seems to recognize the path to Perl (/usr/bin/perl, for example) because if I put in an invalid path, it gives an error ("java.io.IOException: /usr/bin/perlssss: not found").

However, if I put in a script name that doesn't exist:
<CFEXECUTE NAME="/usr/bin/perl" ARGUMENTS="doesntexist.pl" TIMEOUT="60"/>
I don't get an error. It's just not attempting to execute anything.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Dec 07, 2007 Dec 07, 2007

Copy link to clipboard

Copied

Grant,

What happens if you give a full pathname to the script? In your example, you just had doesntexist.pl without a full path.

Seems like perl is running, but it might be outputting an error to stderr. Does CFEXECUTE capture stderr output, or only stdout? (I don't know offhand.)

James

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 07, 2007 Dec 07, 2007

Copy link to clipboard

Copied

I did try the full path. No luck.

I don't think CFEXECUTE captures stderr output.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 17, 2007 Dec 17, 2007

Copy link to clipboard

Copied

Any other ideas?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Dec 17, 2007 Dec 17, 2007

Copy link to clipboard

Copied

Is the CF service running under the system account? And does the system account have execute access to the Perl exe? Are there any credentials required to execute the Perl script? Even if not, is there any way to pass credentials as an argument?

I had a similar problem a while back that drove me mad for days, related to attempting to execute svn.exe with various parameters. The cleanup and info actions worked fine, but the update action would fail (and hang the cmd.exe process). Turns out I found a command line switch to explicitly pass along my svn credentials, and that did the trick.

Have you successfully CFExecuted ANY Perl script? If you try one that simply echoes a hello, does that work?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 04, 2020 Jan 04, 2020

Copy link to clipboard

Copied

Hi,

The perl script runs fine from the command line but when I execute the same perl script using the coldfusion cfexecute it fails to run.

 

It cannot find the methods/functions used in the perl script like SelectAllEditableRanges, Bookmarks, InsertAfter. The script fails whereever this functions are called in the perl script.

 

How do I run the perl script using cfexecute.

 

Thanks.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 04, 2020 Jan 04, 2020

Copy link to clipboard

Copied

Show us what you're using for the cfexecute attributes, and the command you use at the command line. 

 

Also, I'm not sure it's wise to just drop a reply into a 12 year old thread like this. It's possible the previous participants either are no longer involved, not able to help, or may even not want to hear from us (if they're setup to receive amail notifications of replies in this thread). 


/Charlie (troubleshooter, carehart.org)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 06, 2020 Jan 06, 2020

Copy link to clipboard

Copied

I have a perl script which runs fine from the command prompt but fails to run the coldfusion using cfexecute

<CFEXECUTE NAME="c:\perl64\perl.exe" ARGUMENTS="c:\temp\test.pl #filename# #empno#" TIMEOUT="100"> </CFEXECUTE>
In the test.pl I open the #filename# word document and find the bookmark employee number and update the bookmark with the #empno# value.

The script runs with out any errors from command prompt. But, when I run from coldfusion the word running in the background and the only way to fix the stalling is to terminate the process.

I have tested the hello.pl using the cfexecute and it works fine from the coldfusion.

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 06, 2020 Jan 06, 2020

Copy link to clipboard

Copied

What's the value of #filename#? If it's a relative vs absolute path, that may be your problem.

 

If that's not it, simplify things to find what perhaps DOES work if you make changes, such as calling a simpler pl file, or something other than perl, etc. 


/Charlie (troubleshooter, carehart.org)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 06, 2020 Jan 06, 2020

Copy link to clipboard

Copied

The #filename# is c:\temp\test.doc. cfexecute opens the word document fine.

In the perl script I call other methods like bookmark and cfexecute fails to find the methods in the word. 

Any idea if I need to use the cf_exec tag?

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 06, 2020 Jan 06, 2020

Copy link to clipboard

Copied

I'm out of ideas for now. Have only been answering off the top of my head not testing things. Maybe someone else (or I, later) may see the solution for you. There must be one, or a clear explanation why what you want to do doesn't work.

 

But as that other option was indeed offered  in the other thread you opened on the cf portal, it's worth a shot if you're pressed for time. 


/Charlie (troubleshooter, carehart.org)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 08, 2020 Jan 08, 2020

Copy link to clipboard

Copied

LATEST

I did a quick search for SelectAllEditableRanges, and it seems your perl script is possibly using Microsoft Office Automation to process the document.  It's probably trying to execute MS Word and that's where it could be failing.  This article may be of use to you:

 

http://shamcf.blogspot.com/2014/08/not-able-to-run-vbscript-using.html

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation