Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

HH-34942 fix init-script exit codes to be more complying to LSB

  • Loading branch information...
commit 05b8a22703c6af513bc5040da5af1b3ecfae1d1b 1 parent 20dd58c
@alekseyrybalkin alekseyrybalkin authored
Showing with 9 additions and 3 deletions.
  1. +9 −3 tornado_util/supervisor.py
View
12 tornado_util/supervisor.py
@@ -23,6 +23,11 @@
script='/usr/bin/frontik_srv.py',
config='/etc/frontik/frontik.cfg'
)
+
+All exit codes returned by commands are trying to be compatible with LSB standard [1] as much as possible
+
+[1] http://refspecs.linuxbase.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/iniscrptact.html
+
"""
import signal
@@ -201,7 +206,7 @@ def status(expect=None):
return 1
else:
logging.info('all workers are stopped')
- return 0
+ return 3
def supervisor(script, config):
@@ -223,10 +228,11 @@ def supervisor(script, config):
elif cmd == 'stop':
stop()
- sys.exit(status(expect='stopped'))
+ status_code = status(expect='stopped')
+ sys.exit(0 if status_code == 3 else 1)
elif cmd == 'status':
- status()
+ sys.exit(status())
else:
logging.error('either --start, --stop, --restart or --status should be present')
Please sign in to comment.
Something went wrong with that request. Please try again.