diff --git a/src/allmydata/scripts/startstop_node.py b/src/allmydata/scripts/startstop_node.py
index bc2616e..467f42e 100644
|
a
|
b
|
class RunOptions(BasedirMixin, BaseOptions): |
| 29 | 29 | ["multiple", "m", None, "['tahoe run' cannot accept multiple node directories]"], |
| 30 | 30 | ] |
| 31 | 31 | |
| 32 | | def do_start(basedir, opts, out=sys.stdout, err=sys.stderr): |
| | 32 | def do_start(basedir, opts, out=sys.stdout, err=sys.stderr, fork=False): |
| 33 | 33 | print >>out, "STARTING", quote_output(basedir) |
| 34 | 34 | if not os.path.isdir(basedir): |
| 35 | 35 | print >>err, "%s does not look like a directory at all" % quote_output(basedir) |
| … |
… |
def do_start(basedir, opts, out=sys.stdout, err=sys.stderr): |
| 57 | 57 | if opts["profile"]: |
| 58 | 58 | args.extend(["--profile=profiling_results.prof", "--savestats",]) |
| 59 | 59 | # now we're committed |
| | 60 | if fork: |
| | 61 | if os.fork() != 0: |
| | 62 | return 0 # parent |
| | 63 | # we're in the child |
| 60 | 64 | os.chdir(basedir) |
| 61 | 65 | from twisted.scripts import twistd |
| 62 | 66 | sys.argv = args |
| … |
… |
def do_stop(basedir, out=sys.stdout, err=sys.stderr): |
| 123 | 127 | |
| 124 | 128 | def start(config, stdout, stderr): |
| 125 | 129 | rc = 0 |
| 126 | | for basedir in config['basedirs']: |
| 127 | | rc = do_start(basedir, config, stdout, stderr) or rc |
| | 130 | for basedir in config['basedirs'][:-1]: |
| | 131 | # fork before starting all but the last one |
| | 132 | rc = do_start(basedir, config, stdout, stderr, fork=True) or rc |
| | 133 | # start the last one in the current process, to capture its exit code |
| | 134 | rc = do_start(config['basedirs'][-1], config, stdout, stderr, fork=False) or rc |
| 128 | 135 | return rc |
| 129 | 136 | |
| 130 | 137 | def stop(config, stdout, stderr): |
| … |
… |
def restart(config, stdout, stderr): |
| 143 | 150 | if rc: |
| 144 | 151 | print >>stderr, "not restarting" |
| 145 | 152 | return rc |
| 146 | | for basedir in config['basedirs']: |
| 147 | | rc = do_start(basedir, config, stdout, stderr) or rc |
| | 153 | rc = start(config, stdout, stderr) or rc |
| 148 | 154 | return rc |
| 149 | 155 | |
| 150 | 156 | def run(config, stdout, stderr): |