blob: 665a0bae6eec95b4ca8a7076f77cd497566481ea [file] [log] [blame]
Ashlesh Gawande792c6aa2015-07-10 12:18:36 -05001#!/usr/bin/env python
2import os
3
4class NdnApplication:
5 def __init__(self, node):
6 self.node = node
7 self.isRunning = False
8
9 def start(self, command):
10 if self.isRunning is True:
11 try:
12 os.kill(int(self.processId), 0)
13 except OSError:
14 self.isRunning = False
15
16 if self.isRunning is False:
17 self.node.cmd(command)
18 self.processId = self.node.cmd("echo $!")[:-1]
19
20 self.isRunning = True
21
22 def stop(self):
23 if self.isRunning:
24 self.node.cmd("sudo kill %s" % self.processId)
25
26 self.isRunning = False