forked from wazuh/wazuh-docker
Add function to rename files and directories
This commit is contained in:
@@ -74,6 +74,23 @@ apply_exclusion_data() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
# This function will rename in the permanent data volume every file
|
||||||
|
# contained in PERMANENT_DATA_MOVE
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
move_data_files() {
|
||||||
|
for mov_file in "${PERMANENT_DATA_MOVE[@]}"; do
|
||||||
|
file_split=( $mov_file )
|
||||||
|
if [ -e ${file_split[0]} ]
|
||||||
|
then
|
||||||
|
print "moving ${mov_file}"
|
||||||
|
exec_cmd "mv -f ${mov_file}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
# This function will delete from the permanent data volume every file
|
# This function will delete from the permanent data volume every file
|
||||||
# contained in PERMANENT_DATA_DEL
|
# contained in PERMANENT_DATA_DEL
|
||||||
@@ -158,6 +175,9 @@ main() {
|
|||||||
# Restore files stored in permanent data that are not permanent (i.e. internal_options.conf)
|
# Restore files stored in permanent data that are not permanent (i.e. internal_options.conf)
|
||||||
apply_exclusion_data
|
apply_exclusion_data
|
||||||
|
|
||||||
|
# Rename files stored in permanent data (i.e. queue/ossec)
|
||||||
|
move_data_files
|
||||||
|
|
||||||
# Remove some files in permanent_data (i.e. .template.db)
|
# Remove some files in permanent_data (i.e. .template.db)
|
||||||
remove_data_files
|
remove_data_files
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ PERMANENT_DATA[((i++))]="/var/ossec/api/configuration"
|
|||||||
PERMANENT_DATA[((i++))]="/var/ossec/etc"
|
PERMANENT_DATA[((i++))]="/var/ossec/etc"
|
||||||
PERMANENT_DATA[((i++))]="/var/ossec/logs"
|
PERMANENT_DATA[((i++))]="/var/ossec/logs"
|
||||||
PERMANENT_DATA[((i++))]="/var/ossec/queue"
|
PERMANENT_DATA[((i++))]="/var/ossec/queue"
|
||||||
PERMANENT_DATA[((i++))]="/var/ossec/queue/sockets"
|
|
||||||
PERMANENT_DATA[((i++))]="/var/ossec/queue/logcollector"
|
PERMANENT_DATA[((i++))]="/var/ossec/queue/logcollector"
|
||||||
PERMANENT_DATA[((i++))]="/var/ossec/agentless"
|
PERMANENT_DATA[((i++))]="/var/ossec/agentless"
|
||||||
PERMANENT_DATA[((i++))]="/var/ossec/var/multigroups"
|
PERMANENT_DATA[((i++))]="/var/ossec/var/multigroups"
|
||||||
@@ -64,5 +63,9 @@ export PERMANENT_DATA_EXCP
|
|||||||
# Files mounted in a volume that should be deleted
|
# Files mounted in a volume that should be deleted
|
||||||
i=0
|
i=0
|
||||||
PERMANENT_DATA_DEL[((i++))]="/var/ossec/queue/db/.template.db"
|
PERMANENT_DATA_DEL[((i++))]="/var/ossec/queue/db/.template.db"
|
||||||
PERMANENT_DATA_DEL[((i++))]="/var/ossec/queue/ossec"
|
|
||||||
export PERMANENT_DATA_DEL
|
export PERMANENT_DATA_DEL
|
||||||
|
|
||||||
|
i=0
|
||||||
|
PERMANENT_DATA_MOVE[((i++))]="/var/ossec/logs/ossec /var/ossec/logs/wazuh"
|
||||||
|
PERMANENT_DATA_MOVE[((i++))]="/var/ossec/queue/ossec /var/ossec/queue/sockets"
|
||||||
|
export PERMANENT_DATA_MOVE
|
||||||
Reference in New Issue
Block a user