Author Topic: finding the best function for filecopy'ing the console.log  (Read 446 times)

Thought it would be cool for some people I host for to have their console logs saved since their servers restart automatically some seconds after quitting the server.

The code and package execute just fine but upon quit(); there is are no backup log files created. I am assuming this is because the console.log is still open and thus not able to be copied? Would there be a better function?

Code: [Select]
package consoleLogSaver
{
function destroyServer()
{
$ConsoleLogBackupName = "config/server/ConsoleLogs/console_" @ strReplace(getWord(getDateTime(), 0),"/","-") @ "_" @ strReplace(getWord(getDateTime(),1),":","-") @ ".log";
filecopy("console.log" , $ConsoleLogBackupName);
parent::destroyServer();
}
};
activatePackage(consoleLogSaver);


It's because console.log is not in a default directory.

The alternative would be to make (or modify the) a batch file that runs the server, then after it's closed, copy the console.log somewhere else.