我想轮换系统日志进行测试。
sudo logrotate -f /var/log/syslog
[sudo] password for stephen:
error: Ignoring /var/log/syslog because the file owner is wrong (should be root or user with uid 0).
楼主是这样的:
ll /var/log/syslog
-rw-r----- 1 syslog adm 268K 2020-08-01 08:39 /var/log/syslog
好的,但让我们尝试使用 root shell。
#echo $UID
0
#logrotate -f /var/log/syslog
error: Ignoring /var/log/syslog because the file owner is wrong (should be root or user with uid 0).
错误在哪里?解决方法是什么?
用法:logrotate [-dfv?] [-d|--debug] [-f|--force] [-m|--mail=command] [-s|--state=statefile] [-v|--详细] [-l|--log=logfile] [--version] [-?|--help] [--usage] [OPTION...] < configfile >
sudo logrotate -f /etc/logrotate.conf
它必须在配置文件上运行...这将在配置指定的所有日志上运行 logrotate。