I'm writing distillery control software. Was going to go PLC route but found the Yun and I think it's the way to go. I've got the openwrt side set up using the following software stack
PHP
Smarty
Dojo
SQLite
and it's now serving up dynamically created pages. I'm pretty amazed at what this little thing can do. Primarily what the system does is to look at temps and take an action; I'll spare you the detalis. What I'm looking for is the least expensive way to acquire two dozen temps and get them to the linux side. Although I have no qualms about using the bridgeclient and bridge server, it seems they are a bit heavy. What I have in place now as a kind of POC is the following:
#include <Process.h>
void setup() {
Bridge.begin();
SerialUSB.begin(9600);
// Wait...
while (!SerialUSB);
tryIt();
}
void loop() {
// Nope
}
void tryIt() {
Process p;
SerialUSB.print("here goes...");
// Loop through 18b20s and get their temps
// (String crafted just to prove concept)
p.runShellCommandAsynchronously("echo \"t1:8|t2:9|t3:10\">/mnt/sda1/tempData");
SerialUSB.print("done.");
// If success should get nothing, otherwise error from openwrt
while (p.available() > 0) {
char c = p.read();
SerialUSB.print(c);
}
SerialUSB.flush();
}
This works absolutely fine. What did not work was if the file didn't exist on the SD card (in this case /tempData)
Question 1: What process runs the script that interprets and executes the shell command? Who is the owner of this process?
I dug through the source and found what I believe is the command:
/bin/ash -C "the shell command"
When I run it from the linux shell it works as expected:
/bin/ash -c "/bin/echo foo>bar"
creates a file called bar having the contents of foo. Another issue on the linux side, I cant set permission to world writeable using either 666 or og+w
Question 2: How do I set world writeable permissions on a file?
and in closing
Question 3: Is using Process the lowest cost method of writing a lengthy string of text?