Skip to content

Commit b9db0d4

Browse files
committed
BUGFIXES:
- Error on shutdown, if no dcs.log exists
1 parent 83198cb commit b9db0d4

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

core/data/impl/serverimpl.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -623,9 +623,10 @@ async def shutdown(self, force: bool = False) -> None:
623623
await asyncio.sleep(1)
624624
await self._terminate()
625625
self.status = Status.SHUTDOWN
626-
shutil.copy2(os.path.join(self.instance.home, 'Logs', 'dcs.log'),
627-
os.path.join(self.instance.home, 'Logs',
628-
f"dcs-{datetime.now(timezone.utc).strftime('%Y%m%d-%H%M%S')}.log"))
626+
logfile = os.path.join(self.instance.home, 'Logs', 'dcs.log')
627+
if os.path.exists(logfile):
628+
shutil.copy2(logfile, os.path.join(self.instance.home, 'Logs',
629+
f"dcs-{datetime.now(timezone.utc).strftime('%Y%m%d-%H%M%S')}.log"))
629630

630631
async def is_running(self) -> bool:
631632
async with self.lock:

services/monitoring/service.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,8 @@ async def heartbeat(self):
195195
logfile = os.path.join(server.instance.home, 'Logs', 'dcs.log')
196196
if os.path.exists(logfile):
197197
now = datetime.now(timezone.utc)
198-
shutil.copy2(os.path.join(server.instance.home, 'Logs', 'dcs.log'),
199-
os.path.join(server.instance.home, 'Logs', f"dcs-{now.strftime('%Y%m%d-%H%M%S')}.log"))
198+
shutil.copy2(logfile, os.path.join(server.instance.home,
199+
'Logs', f"dcs-{now.strftime('%Y%m%d-%H%M%S')}.log"))
200200
title = f'Server "{server.name}" died!'
201201
message = 'Setting state to SHUTDOWN.'
202202
self.log.warning(title + ' ' + message)

0 commit comments

Comments
 (0)