Topic: run shell Script from Flash

Hello,
I am new to flash.
I put a test.sh script into the chumby folder /psp/cgi-bin/ and made it executable.
how do I run it from my widget?

on other postst in the forum i found out it should be sth like

myXml = new XML(); 
myXml.load("http://chumbyIP/cgi-bin/custom/test.sh");

but that ain't working for me sad

Could this be due to a crossdomain issue?
Could anybody help me out here?

Re: run shell Script from Flash

Yes, it's definitely cross-domain related.

You need a crossdomain.xml file in the directory and have your widget load that policy file before it tries to access the script.  You'll also need to configure the server to serve the XML file correctly with the text/xml mime type.  See http://wiki.chumby.com/mediawiki/index. … TTP_server for details on that part.

Re: run shell Script from Flash

thank you.

two questions:

1. I have a chumby classic and i can't find a httpd.conf in the /etc/ folder. Can I simply add it?

2. Doesn't the crossdomain.xml have to be in the root folder (id so I don't have write access)

Re: run shell Script from Flash

httpd.conf should be able to live in the /psp/cgi-bin directory -- it will only affect files served from that directory. 

The crossdomain.xml file can live in the /psp/cgi-bin folder if you first use security.loadPolicyFile("http://localhost/cgi-bin/custom/crossdomain.xml") to explicitly load a policy file from a subdirectory.

(Note, I only tried this with the upgraded busybox I'm using on my personal Chumby One).

Re: run shell Script from Flash

OK i tried it.

When I run the widget from my computer the shell scripts get executed as i want but i retrieve the following error:

Error opening URL http:/localhost/cgi-bin/custom/crossdomain.xml

running the widget from chumby does not execute the scripts.

Re: run shell Script from Flash

localhost refers to the computer on which the widget is run.  This works when the widget is on the chumby, but if you're running it on your PC it's going to try to connect to itself, not the Chumby device.

7 (edited by johanna 2010-02-20 04:49:17)

Re: run shell Script from Flash

sorry, pasted the wrong error.
I replaced localhost with the chumby IP I still got the following error:

Error opening URL http:/192.***.***.**/cgi-bin/custom/crossdomain.xml

So the httpd.conf solution didn't work out for me, but this one from NigelS did:
http://forum.chumby.com/viewtopic.php?id=4623



One last question, I do have to call
System.security.loadPolicyFile("http://"+ipaddress+"/cgi-bin/custom/photos.pl?POLICY");

only once per widget right? (or before every call ?)

Re: run shell Script from Flash

You should only have to use the loadPolicyFile once on widget startup.

I think the httpd.conf change requires the updated busybox which can't be easily installed on the classic Chumby.  Glad you found a solution.