use a shell script to start SMF and detach stdin/stdout/stderr
(Boeing r1822)
This commit is contained in:
parent
a69396d1d5
commit
3b01f99e2c
1 changed files with 16 additions and 6 deletions
|
@ -83,16 +83,21 @@ class NrlSmf(NrlService):
|
|||
''' Simplified Multicast Forwarding for MANET networks.
|
||||
'''
|
||||
_name = "SMF"
|
||||
_startup = ("nrlsmf", )
|
||||
_startup = ("sh startsmf.sh", )
|
||||
_shutdown = ("killall nrlsmf", )
|
||||
_validate = ("pidof nrlsmf", )
|
||||
_configs = ("startsmf.sh", )
|
||||
|
||||
@classmethod
|
||||
def getstartup(cls, node, services):
|
||||
''' Generate the appropriate command-line based on node interfaces.
|
||||
def generateconfig(cls, node, filename, services):
|
||||
''' Generate a startup script for SMF. Because nrlsmf does not
|
||||
daemonize, it can cause problems in some situations when launched
|
||||
directly using vcmd.
|
||||
'''
|
||||
cmd = cls._startup[0]
|
||||
cmd += " instance %s_smf" % node.name
|
||||
cfg = "#!/bin/sh\n"
|
||||
cfg += "# auto-generated by nrl.py:NrlSmf.generateconfig()\n"
|
||||
comments = ""
|
||||
cmd = "nrlsmf instance %s_smf" % (node.name)
|
||||
|
||||
servicenames = map(lambda x: x._name, services)
|
||||
netifs = filter(lambda x: not getattr(x, 'control', False), \
|
||||
|
@ -101,13 +106,16 @@ class NrlSmf(NrlService):
|
|||
return ()
|
||||
|
||||
if "arouted" in servicenames:
|
||||
comments += "# arouted service is enabled\n"
|
||||
cmd += " tap %s_tap" % (node.name,)
|
||||
cmd += " unicast %s" % cls.firstipv4prefix(node, 24)
|
||||
cmd += " push lo,%s resequence on" % netifs[0].name
|
||||
if len(netifs) > 0:
|
||||
if "NHDP" in servicenames:
|
||||
comments += "# NHDP service is enabled\n"
|
||||
cmd += " ecds "
|
||||
elif "OLSR" in servicenames:
|
||||
comments += "# OLSR service is enabled\n"
|
||||
cmd += " smpr "
|
||||
else:
|
||||
cmd += " cf "
|
||||
|
@ -116,7 +124,9 @@ class NrlSmf(NrlService):
|
|||
|
||||
cmd += " hash MD5"
|
||||
cmd += " log /var/log/nrlsmf.log"
|
||||
return (cmd, )
|
||||
|
||||
cfg += comments + cmd + " < /dev/null > /dev/null 2>&1 &\n\n"
|
||||
return cfg
|
||||
|
||||
addservice(NrlSmf)
|
||||
|
||||
|
|
Loading…
Reference in a new issue