Try harder to determine default username

Many cron daemons only set LOGNAME and not $USER, so fall
back to $LOGNAME if $USER isn't set.

Windows uses %USERNAME% for the logged in user.

Finally fall back to "nobody" in case none of these are
set because undef is not a valid value for the Str type.