Use os.popen2() instead of os.fork() to daemonize.
This commit is contained in:
parent
4ba32dc4bf
commit
bbe31367d4
|
@ -70,7 +70,8 @@ def start_daemon():
|
|||
version=deluge.common.get_version())
|
||||
parser.add_option("-p", "--port", dest="port",
|
||||
help="Port daemon will listen on", action="store", type="int")
|
||||
|
||||
parser.add_option("-d", "--do-not-daemonize", dest="donot",
|
||||
help="Do not daemonize", action="store_true", default=False)
|
||||
# Get the options and args from the OptionParser
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
|
@ -82,7 +83,12 @@ def start_daemon():
|
|||
|
||||
from deluge.core.daemon import Daemon
|
||||
|
||||
if options.donot:
|
||||
log.info("Starting daemon..")
|
||||
pid = os.fork()
|
||||
if not pid:
|
||||
Daemon(options.port)
|
||||
else:
|
||||
cmd = "deluged -d " + "".join(a for a in args)
|
||||
if options.port != None:
|
||||
cmd = cmd + " -p %s" % options.port
|
||||
|
||||
os.popen2(cmd)
|
||||
|
|
Loading…
Reference in New Issue