fix get script username

This commit is contained in:
xiaomlove
2025-01-19 19:09:16 +08:00
parent 971a4b7702
commit 02a95cba71
5 changed files with 23 additions and 10 deletions

View File

@@ -265,7 +265,8 @@ function getLogFile($append = '')
$name .= "-$append";
}
if (isRunningInConsole()) {
$name .= sprintf("-cli-%s-%s", get_current_user(), getmyuid());
$scriptUserInfo = posix_getpwuid(posix_getuid());
$name .= sprintf("-cli-%s", $scriptUserInfo['name']);
}
$logFile = sprintf('%s-%s%s', $name, date('Y-m-d'), $suffix);
return $logFiles[$append] = $logFile;