Correcting path for clamav-daemon.service

This commit is contained in:
dpeca 2016-11-17 17:44:01 +01:00
commit fa73d16538
2 changed files with 9 additions and 5 deletions

View file

@ -1045,8 +1045,8 @@ if [ "$clamd" = 'yes' ]; then
mkdir /var/run/clamav
fi
chown -R clamav:clamav /var/run/clamav
if [ -f "/etc/systemd/system/multi-user.target.wants/clamav-daemon.service" ]; then
file="/etc/systemd/system/multi-user.target.wants/clamav-daemon.service"
if [ -f "/lib/systemd/system/clamav-daemon.service" ]; then
file="/lib/systemd/system/clamav-daemon.service"
if [ $( grep -ic "mkdir" $file ) -eq 0 ]; then
sed -i "s/\[Service\]/\[Service\]\nExecStartPre = \/bin\/mkdir -p \/var\/run\/clamav\nExecStartPre = \/bin\/chown -R clamav:clamav \/var\/run\/clamav/g" $file
fi

View file

@ -121,10 +121,14 @@ fi
# Fixing /var/run/clamav permissions
if [ -f "/etc/systemd/system/multi-user.target.wants/clamav-daemon.service" ]; then
file="/etc/systemd/system/multi-user.target.wants/clamav-daemon.service"
if [ -f "/lib/systemd/system/clamav-daemon.service" ]; then
file="/lib/systemd/system/clamav-daemon.service"
if [ $( grep -ic "mkdir" $file ) -eq 0 ]; then
sed -i "s/\[Service\]/\[Service\]\nExecStartPre = \/bin\/mkdir -p \/var\/run\/clamav\nExecStartPre = \/bin\/chown -R clamav:clamav \/var\/run\/clamav/g" $file
service clamav-daemon restart
if [ ! -d "/var/run/clamav" ]; then
mkdir /var/run/clamav
fi
chown -R clamav:clamav /var/run/clamav
service clamav-daemon restart /dev/null 2>&1
fi
fi