Update to previous post: ------------------------
I wrote a little C++ program with a system() call, calling the script without DTNTrigger to see if ::system(cmd.c_str()) call works in the first place. (Procedure exact same as in the dtntrigger.exe). I have tested this on both ubuntu and RaspberryPI (ARM based)
#include <csignal> #include <ctype.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h>
#include <iostream> using namespace std;
std::string _script = "bashScript.sh &"; std::string _shell = "/bin/sh";
int main() { cout << "!!!Hello World!!!" << endl; // call the script std::string cmd = _shell + " " + _script + " " + "Node A" + " " + "/home/s116793/something"; cout << "The cmd is:"<<cmd<<endl; ::system(cmd.c_str()); return 0; }
Script contents: ----------- #!/bin/sh echo "Hello guys.." python /home/s116793/triggered.py
Output ------ !!!Hello World!!! The cmd is:/bin/sh bashScript.sh & Node A /home/s116793/something sh: 1: Node: not found /bin/sh: 0: Can't open bashScript.sh
Observations: ------------ 1) The bashscript.sh is in the same path as the executable in /Debug and it has 'full' permissions (chmod 777). I tried googling it seems to be a known problem for different reasons, not sure what's the problem here. Any expert advice?
2) Something wrong with the way I call? Can someone run this on their system and post some example here?
Thanks.