copy the seastatus before first start after boot time
after a crash the previous seastatus is not read correctly for debugging reasons we should check if the status file is invalid
This commit is contained in:
parent
785ca1b290
commit
7f2ba5766c
26
seaman.py
26
seaman.py
@ -24,6 +24,7 @@ import sys
|
|||||||
import time
|
import time
|
||||||
import termios
|
import termios
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import psutil
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
from os.path import join, exists
|
from os.path import join, exists
|
||||||
@ -112,8 +113,26 @@ class SeaManager(ServiceManager):
|
|||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
os.system('cp %s ./' % sea_server_src)
|
os.system('cp %s ./' % sea_server_src)
|
||||||
|
if service == 'sea':
|
||||||
|
# debugging: copy status file in case of a reboot
|
||||||
|
seastatus = self.get_sea_status(ins)
|
||||||
|
if seastatus:
|
||||||
|
boot_time = time.strftime("%Y-%m-%dT%H-%M-%S", time.localtime(psutil.boot_time()))
|
||||||
|
dst = seastatus.replace('.tcl', '') + '.' + boot_time
|
||||||
|
if not exists(dst):
|
||||||
|
os.system(f'cp {seastatus} {dst}')
|
||||||
return start_dir, env
|
return start_dir, env
|
||||||
|
|
||||||
|
def get_sea_status_file(self, ins):
|
||||||
|
searoot = self.env[ins].get('SEA_ROOT', '')
|
||||||
|
seastatus = join(searoot, ins, 'status', 'seastatus.tcl')
|
||||||
|
if exists(seastatus):
|
||||||
|
return seastatus
|
||||||
|
seastatus = join(searoot, 'status', 'seastatus.tcl')
|
||||||
|
if exists(seastatus):
|
||||||
|
return seastatus
|
||||||
|
return None
|
||||||
|
|
||||||
def get_cfg(self, ins, service, addconfirmed=False):
|
def get_cfg(self, ins, service, addconfirmed=False):
|
||||||
"""return cfg info about running programs, if relevant
|
"""return cfg info about running programs, if relevant
|
||||||
|
|
||||||
@ -124,11 +143,8 @@ class SeaManager(ServiceManager):
|
|||||||
if 'sea' not in self.get_procs().get(ins, ()):
|
if 'sea' not in self.get_procs().get(ins, ()):
|
||||||
return ''
|
return ''
|
||||||
try:
|
try:
|
||||||
searoot = self.env[ins].get('SEA_ROOT', '')
|
seastatus = self.get_sea_status(ins)
|
||||||
seastatus = join(searoot, ins, 'status', 'seastatus.tcl')
|
if not seastatus:
|
||||||
if not exists(seastatus):
|
|
||||||
seastatus = join(searoot, 'status', 'seastatus.tcl')
|
|
||||||
if not exists(seastatus):
|
|
||||||
return '?'
|
return '?'
|
||||||
result = ['', '']
|
result = ['', '']
|
||||||
confirmed = ''
|
confirmed = ''
|
||||||
|
Loading…
x
Reference in New Issue
Block a user