Permalink
Browse files

all output is now captured and redirected to stdout on error

  • Loading branch information...
1 parent 41f0b9c commit b93540632b14ebfc7ccbc4320a1a7e631d1829be @sean-m committed Feb 6, 2013
Showing with 12 additions and 13 deletions.
  1. +12 −13 jira-init
View
@@ -59,18 +59,16 @@ def isAlive(pid):
def start():
- count = 0
-
- if not locked() and status() != 0:
+ if not locked():
print('Starting ' + APP_NAME + '...')
-
try:
- init = subprocess.check_call(APP_DIR + APP_START , shell=False)
- except:
+ init = subprocess.check_output(APP_DIR + APP_START, shell=False, stderr=subprocess.STDOUT)
+ lock()
+ except subprocess.CalledProcessError, e:
print('There was an error starting ' + APP_NAME)
- return init.returncode
+ print(e.output)
+ return e.returncode
- lock()
status()
else:
print('Service locked, check status.')
@@ -80,15 +78,16 @@ def stop():
"""
Shut everything down, clean up.
"""
-
- if locked():
+ if locked():
print('Stopping ' + APP_NAME + '...')
try:
- subprocess.check_call(APP_DIR + APP_STOP, shell=False)
+ init = subprocess.check_output(APP_DIR + APP_STOP, shell=False, stderr=subprocess.STDOUT)
unlock()
- except:
+ except subprocess.CalledProcessError, e:
print('There was an error stopping ' + APP_NAME)
- return subprocess.returncode
+ print(e.output)
+ return e.returncode
+
status()
else:
print('No process lock, check status.')

0 comments on commit b935406

Please sign in to comment.