Use stat to get owner of /var/log
This commit is contained in:
parent
6fd7e0311c
commit
2c16a75ef1
|
@ -939,10 +939,16 @@ installLogrotate() {
|
||||||
echo ":::"
|
echo ":::"
|
||||||
echo -n "::: Installing latest logrotate script..."
|
echo -n "::: Installing latest logrotate script..."
|
||||||
cp /etc/.pihole/advanced/logrotate /etc/pihole/logrotate
|
cp /etc/.pihole/advanced/logrotate /etc/pihole/logrotate
|
||||||
# Raspbian will use the default "su root root"
|
# Different operating systems have different user / group
|
||||||
# Ubuntu will use a custom user/group "su root syslog"
|
# settings for logrotate that makes it impossible to create
|
||||||
# We read the global config file and copy what we find into our file
|
# a static logrotate file that will work with e.g.
|
||||||
echo $(sed '/^su/!d' /etc/logrotate.conf) >> /etc/pihole/logrotate
|
# Rasbian and Ubuntu at the same time. Hence, we have to
|
||||||
|
# customize the logrotate script here in order to reflect
|
||||||
|
# the local properties of the /var/log directory
|
||||||
|
logusergroup="$(stat -c '%U %G' /var/log)"
|
||||||
|
if [[ ! -z $logusergroup ]]; then
|
||||||
|
echo "su ${logusergroup}" >> /etc/pihole/logrotate
|
||||||
|
fi
|
||||||
echo " done!"
|
echo " done!"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue