Proper handle of sigterm signal, log reason of shutdown

This commit is contained in:
shortcutme 2019-03-23 03:41:42 +01:00
parent 16f36824e6
commit faba28dd94
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE
2 changed files with 23 additions and 20 deletions

View file

@ -15,12 +15,6 @@ def main():
main = None
try:
import signal
try:
signal.signal(signal.SIGTERM, lambda signum, stack_frame: sys.exit(0))
except Exception as err:
print("Error setting up SIGTERM watcher: %s" % err)
app_dir = os.path.dirname(os.path.abspath(__file__))
os.chdir(app_dir) # Change working dir to zeronet.py dir
sys.path.insert(0, os.path.join(app_dir, "src/lib")) # External liblary directory