summaryrefslogtreecommitdiff
path: root/src/services
diff options
context:
space:
mode:
Diffstat (limited to 'src/services')
-rwxr-xr-xsrc/services/vyos-http-api-server8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/services/vyos-http-api-server b/src/services/vyos-http-api-server
index b5ad8b159..a3624052e 100755
--- a/src/services/vyos-http-api-server
+++ b/src/services/vyos-http-api-server
@@ -22,6 +22,7 @@ import grp
import json
import traceback
import threading
+import signal
import vyos.config
@@ -350,6 +351,8 @@ def show_op():
return success(res)
+def shutdown():
+ raise KeyboardInterrupt
if __name__ == '__main__':
# systemd's user and group options don't work, do it by hand here,
@@ -372,4 +375,9 @@ if __name__ == '__main__':
app.config['vyos_keys'] = server_config['api_keys']
app.config['vyos_debug'] = server_config['debug']
+ def sig_handler(signum, frame):
+ shutdown()
+
+ signal.signal(signal.SIGTERM, sig_handler)
+
bottle.run(app, host=server_config["listen_address"], port=server_config["port"], debug=True)