mirror of
https://github.com/goharbor/harbor
synced 2024-09-20 14:45:37 +00:00
Logrotate fails when cwd is not accessible
Logrotate is run with sudo as the syslog user by cron.hourly The current working directory is `/root` which is inaccessible to the syslog user so the logrotate command fails. Currently the following stderr is being thrown away by the cron script: ``` error: cannot open current directory: Permission denied ``` Fixes #15468 Signed-off-by: Christopher Jenkins <christj@gmail.com>
This commit is contained in:
parent
ff617950b7
commit
0585b148c7
|
@ -2,5 +2,6 @@
|
||||||
|
|
||||||
# run the logrotate with user 10000, the state file "/var/lib/logrotate/logrotate.status"
|
# run the logrotate with user 10000, the state file "/var/lib/logrotate/logrotate.status"
|
||||||
# is specified to avoid the permission error
|
# is specified to avoid the permission error
|
||||||
|
cd /
|
||||||
sudo -u \#10000 -E /usr/sbin/logrotate -s /var/lib/logrotate/logrotate.status /etc/logrotate.conf
|
sudo -u \#10000 -E /usr/sbin/logrotate -s /var/lib/logrotate/logrotate.status /etc/logrotate.conf
|
||||||
exit 0
|
exit 0
|
||||||
|
|
Loading…
Reference in New Issue
Block a user