diff --git a/code/segmentedtickerplant/stplog.q b/code/segmentedtickerplant/stplog.q index a6eb92392..b587c7311 100644 --- a/code/segmentedtickerplant/stplog.q +++ b/code/segmentedtickerplant/stplog.q @@ -283,6 +283,14 @@ init:{[dbname] .dotz.set[`.z.exit;{ if[not x~0i;.lg.e[`stpexit;"Bad exit!"];:()]; .lg.o[`stpexit;"Exiting process"]; + + // flushing in memory data to disk during unexpected shutdown when batchmode is set to memorybatch + if[.stplg.batchmode=`memorybatch; + .lg.o[`stpexit;"STP shutdown unexpectedly, batchmode = `memorybatch, therefore flushing any remaining data to the on-disk log file"]; + .stplg.zts.memorybatch[]; + .lg.o[`stpexit; "Complete!"] + ]; + // exit before logs are touched if process is an sctp NOT in create mode if[.sctp.chainedtp and not .sctp.loggingmode=`create; :()]; .lg.o[`stpexit;"Closing off log files"];