Skip to content

Commit

Permalink
[seiscomp-control] Remove fun- and pid-file upon seiscomp stop
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Hoechner authored and gempa-jabe committed Oct 7, 2024
1 parent 52e6037 commit a731a20
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/system/apps/seiscomp/seiscomp-control.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ def start_module(mod):


def stop_module(mod):
returncode = 0
try:
r = mod.stop()
if r is None:
Expand All @@ -256,26 +257,31 @@ def stop_module(mod):
elif type(r) == type(True):
# Boolean type: True = success, False = error
if not r:
return 1
returncode = 1
elif type(r) == type(0):
# Integer type: 0 = success, error otherwise
if r:
return 1
returncode = 1
else:
# Any other type: Truthy = success, Falsy = error
if not r:
return 1
returncode = 1
except Exception as e:
error(f"Failed to stop {mod.name}: {str(e)}")
return 1

# Delete runfile
# Delete runfile and pidfile
try:
os.remove(env.runFile(mod.name))
runFile = env.runFile(mod.name)
if os.path.isfile(runFile):
os.remove(runFile)
pidFile = f"{runFile.split('.')[0]}.pid"
if os.path.isfile(pidFile):
os.remove(pidFile)
except BaseException:
return 1
returncode = 1

return 0
return returncode


def start_kernel_modules():
Expand Down

0 comments on commit a731a20

Please sign in to comment.