mirror of
https://github.com/ovh/debian-cis.git
synced 2024-11-22 13:37:02 +01:00
FIX(8.2.4): script crashed when touching a logfile in subdir of /var/log
Treating filename to check if it is in a /var/log subdirectory and creates needed subdirectories
This commit is contained in:
parent
9ada868f43
commit
455e58899d
@ -70,6 +70,12 @@ apply () {
|
|||||||
does_file_exist "$FILE"
|
does_file_exist "$FILE"
|
||||||
if [ "$FNRET" != 0 ]; then
|
if [ "$FNRET" != 0 ]; then
|
||||||
info "$FILE does not exist"
|
info "$FILE does not exist"
|
||||||
|
filedir=$(dirname "${FILE#/var/log/}")
|
||||||
|
if [ ! "$filedir" = "." ] && [ ! -d /var/log/"$filedir" ]; then
|
||||||
|
debug "Creating /var/log/$filedir for $FILE"
|
||||||
|
debug "mkdir -p /var/log/"$filedir""
|
||||||
|
mkdir -p /var/log/"$filedir"
|
||||||
|
fi
|
||||||
touch "$FILE"
|
touch "$FILE"
|
||||||
fi
|
fi
|
||||||
FOUND_EXC=0
|
FOUND_EXC=0
|
||||||
|
Loading…
Reference in New Issue
Block a user