optParameters = [
["basedir", "C", None, "which directory to restart the node in"],
]
+ optFlags = [
+ ["force", "f", "if the node is not already running, start it "
+ "instead of complaining that you should have used 'start' instead "
+ "of 'restart'"],
+ ]
class CreateClientOptions(NoDefaultBasedirMixin, usage.Options):
optParameters = [
elif command == "restart":
for basedir in so.basedirs:
rc = stop(basedir, so, stdout, stderr) or rc
+ if rc == 2 and so['force']:
+ print >>stderr, "ignoring couldn't-stop"
+ rc = 0
if rc:
print >>stderr, "not restarting"
return rc
pidfile = os.path.join(basedir, "twistd.pid")
if not os.path.exists(pidfile):
print >>err, "%s does not look like a running node directory (no twistd.pid)" % basedir
- return 1
+ return 2
pid = open(pidfile, "r").read()
pid = int(pid)