fork onionr when restarting or shutting down

This commit is contained in:
Kevin Froman 2019-10-28 22:57:45 -05:00
parent c237efd523
commit df57e2300e
No known key found for this signature in database
GPG Key ID: 0D414D0FE405B63B
2 changed files with 2 additions and 1 deletions

View File

@ -124,9 +124,9 @@ def kill_daemon():
''' '''
Shutdown the Onionr daemon (communicator) Shutdown the Onionr daemon (communicator)
''' '''
logger.warn('Stopping the running daemon...', timestamp = False, terminal=True) logger.warn('Stopping the running daemon...', timestamp = False, terminal=True)
try: try:
os.fork()
events.event('daemon_stop') events.event('daemon_stop')
net = NetController(config.get('client.port', 59496)) net = NetController(config.get('client.port', 59496))
try: try:

View File

@ -33,6 +33,7 @@ SCRIPT_NAME = os.path.dirname(os.path.realpath(__file__)) + f'/../../{onionrvalu
def restart(): def restart():
logger.info('Restarting Onionr', terminal=True) logger.info('Restarting Onionr', terminal=True)
os.fork()
daemonlaunch.kill_daemon() daemonlaunch.kill_daemon()
while localcommand.local_command('ping', maxWait=8) == 'pong!': while localcommand.local_command('ping', maxWait=8) == 'pong!':
time.sleep(0.3) time.sleep(0.3)