I'm using the BIGEXEC node, which runs the command: sudo ./rf95_server , but I'm not seeing any output
When I run the command in a raspberry terminal, it displays some messages on the screen every few seconds
An example of running in the terminal with two messages
Thanks for the reply @Colin
I don't know how to process in node-red the messages generated by the command as shown in the raspberry terminal window, searching the net, I came across the bigexec command ...
Also tried the exec command, as you suggested, but the result doesn't change, I don't get any output message
Your command uses sudo. This will not work because sudo generally requires an extra input on the command line. You would have to edit the sudo permissions to allow the user running Node-RED to issue that command without a password prompt.
Almost certainly, you would be much better allowing the node-red user to access the rf95 software and hardware so that sudo wasn't required.
If you run that command in a terminal, with sudo, does it ask for a password? If so then @TotallyInformation is correct. If it doesn't ask for a password then I guess you have set your pi up (or it was setup like that by default) to not need a pwd when using sudo, which is a security risk. However, if it doesn't ask for a pwd then that is probably not the problem here. In fact, since you see the server in the task list then that is probably not the problem.
Do you see anything in the node red log or in syslog when you start the server?
The user Node-Red starts as is the classic pi
I enabled user pi ,in the file /etc/sudoers,
so that it doesn't ask for pwd by entering the line
pi ALL=(ALL:ALL) NOPASSWD:ALL
The fact that the rf95_server line appears in the tasks means that the command has executed it, if it asked for a pwd it would give an error.
If I try to run the command manually without SUDO in the terminal window, it doesn't ask for the pwd , but the error is thrown paging fault
I see you are using an extremely ancient version of node-red and a long out of support version of nodejs, so I suggest you start by upgrading to the current version of node-red and node.js v16. On a pi you can usually do that by using the script at Running on Raspberry Pi : Node-RED. However, if you are using an also long out of support version of Pi OS then that may be too old to allow an upgrade.
I think stretch is ok still. I presume you have everything useful backed up anyway.
In future if you could copy/paste text rather than screenshot it would be appreciated.
To tell the script to install nodejs 16 and --node16 on the end.
Hello @Colin
I updated Node-Red to version 3.0.2 and with node v16.19.0
and I found the way to run the ./rf95_server program, without using the SUDO command
After these commands, i can run the program, as root user, no matter who started it or from where (no sudo required)
From the task manager , it is noted that in this case , unlike the previous ones , the task ./rf95_server is unique , there are no SH or SUDO parent tasks
Even after these updates the program runs, but I'm not getting any output from the MSG nodes
NOTE : I have the C sources of the program, I can insert a few lines of code and recompile it, if you have any ideas to suggest me
Can you show us what the startup log looks like now please.
Rather than screenshot please copy/paste the text. When pasting use the </> button at the top of the forum entry window to stop the output being interpretted as markdown.
In the C code, what do the lines that output the data look like?
Does it have any command line options to say where to send the output?
pi@raspberrypi:~ $ node-red-log
- /usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/index.js
- /usr/lib/node_modules/node-red/lib/red.js
- /usr/lib/node_modules/node-red/red.js
14 Feb 22:05:55 - [warn] [node-red-contrib-rfm69radio/rfm69-out] 'rfm69-radio' already registered by module node-red-contrib-rfm69radio
14 Feb 22:05:55 - [warn] [node-red-contrib-rfm69radio/rfm69-radio] 'rfm69-radio' already registered by module node-red-contrib-rfm69radio
14 Feb 22:05:55 - [warn] ------------------------------------------------------
14 Feb 22:05:55 - [info] Settings file : /home/pi/.node-red/settings.js
14 Feb 22:05:55 - [info] Context store : 'default' [module=memory]
14 Feb 22:05:55 - [info] User directory : /home/pi/.node-red
14 Feb 22:05:55 - [warn] Projects disabled : set editorTheme.projects.enabled=true to enable
14 Feb 22:05:55 - [warn] Flows file name not set. Generating name using hostname.
14 Feb 22:05:55 - [info] Flows file : /home/pi/.node-red/flows_raspberrypi.json
14 Feb 22:05:55 - [info] Server now running at http://127.0.0.1:1880/
14 Feb 22:05:55 - [warn]
---------------------------------------------------------------------
Your flow credentials file is encrypted using a system-generated key.
If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.
You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.
---------------------------------------------------------------------
14 Feb 22:05:55 - [info] Starting flows
14 Feb 22:05:55 - [info] Started flows
When I run the exec node, no message appears in the log
Part of the C code that writes the outgoing message with printf command
if (rf95.available()) {
#ifdef RF_LED_PIN
led_blink = millis();
digitalWrite(RF_LED_PIN, HIGH);
#endif
// Should be a message for us now
uint8_t buf[RH_RF95_MAX_MESSAGE_LEN];
uint8_t len = sizeof(buf);
uint8_t from = rf95.headerFrom();
uint8_t to = rf95.headerTo();
uint8_t id = rf95.headerId();
uint8_t flags= rf95.headerFlags();;
int8_t rssi = rf95.lastRssi();
if (rf95.recv(buf, &len)) {
printf("Packet[%02d] #%d => #%d %ddB: ", len, from, to, rssi);
printbuffer(buf, len);
} else {
Serial.print("receive failed");
}
printf("\n");
}