DTNTrigger not working: Help!
Hi,
I am trying to run *dtntrigger*, but it is *not working*. Its been many hours since I am trying every way to get it to work!
This is what i am executing on the receiving end: (Lets call this (**) for later)
dtntrigger /bin/sh /home/pi/bashscript.sh
-- *Contents* of bashscript.sh:
#!/bin/sh
echo "Hello guys.." python /home/pi/triggered.py
-- *Contents* of triggered.py: (Just creating a file for verification, that when a bundle is received this be created:)
#!/usr/bin/python
import sys import os
def main(argv): print 'Number of arguments', len(sys.argv), 'arguments' print 'Argument list:', str(sys.argv)
fo = open('/home/pi/text.txt', 'w') fo.write('This is my first file') print 'Name of the file', fo.name fo.close()
if __name__ == "__main__": main(sys.argv[1:]) --
I see from dtntrigger.cpp, this simple call is done:
std::string cmd = _shell + " " + _script + " " + b.getSource.getString() + " " + file.getPath ::system(cmd.c_str())
-- Observations:
1) If I execute just this command "/bin/sh /home/pi/bashscript.sh" without dtntrigger, on my command line, the script executes and creates that 'text.txt' dummy file. While, with dtntrigger it does not.
2) Permissions? Yes, I have given full permissions (chmod 777) to both scripts and as you see given the full file's absolute path as well.
3) When I execute the command (**) it runs (does not break) means __running in C++ code is true. What is wrong then?
4) The bundle is available in /bundles folder (as per my ibrdtnd.conf), bundle is always coming there. I am using raspberryPI. dtnrecv works directly, no problem. I have also used ubuntu, same results!!
5) Can I execute a python script directly instead of going through bash?
6) I doubt ::system(..) call is somehow not working. Running raspbian on PI.
Any help will be much appreciated to get this up and running!
Hello.
If you take a look at the help message of dtntrigger it explains you that you need to define an endpoint for your application as first parameter.
$ dtntrigger -h -- dtntrigger (IBR-DTN) -- Syntax: dtntrigger [options] <name> <shell> [trigger-script] <name> the application name <shell> shell to execute the trigger script [trigger-script] optional: the trigger script to execute on incoming bundle * optional parameters * -h display this text -g <group> join a group -w temporary work directory -s process signed bundles only
Use this command instead: dtntrigger pi-app /bin/sh /home/pi/bashscript.sh
Kind regards, Johannes Morgenroth
On 18.09.2013 01:41, Shyam B wrote:
Hi,
I am trying to run *dtntrigger*, but it is _not working_. Its been many hours since I am trying every way to get it to work!
This is what i am executing on the receiving end: (Lets call this (**) for later)
dtntrigger /bin/sh /home/pi/bashscript.sh
participants (2)
-
Johannes Morgenroth
-
Shyam B