Set xymon as owner for logfiles

This commit is contained in:
Jeremy Gardais 2020-03-11 14:14:16 +01:00
parent 81cb710ec4
commit 48d61ec8a7
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 6 additions and 0 deletions

View File

@ -41,6 +41,9 @@ drivedb_list="${XYMONTMP}/${MACHINEDOTS}.smart.drivedb.list"
# By default, don't empty files newer than 10hours (600 minutes) # By default, don't empty files newer than 10hours (600 minutes)
default_mtime_minutes="600" default_mtime_minutes="600"
xymon_username="xymon"
xymon_groupname="xymon"
# ]]] # ]]]
# Functions # Functions
@ -77,6 +80,7 @@ regenerate_if_too_old() {
if [ "${_file_mtime_seconds}" -gt "${_max_mtime_seconds}" ]; then if [ "${_file_mtime_seconds}" -gt "${_max_mtime_seconds}" ]; then
[ "${debug}" -eq "0" ] && printf "${c_magentab}%-6b${c_reset}\n" "DEBUG: regenerate_if_too_old func Need to empty or create ${_file} last modification happened ${_file_mtime_seconds} seconds ago (maximum is ${_max_mtime_seconds})." [ "${debug}" -eq "0" ] && printf "${c_magentab}%-6b${c_reset}\n" "DEBUG: regenerate_if_too_old func Need to empty or create ${_file} last modification happened ${_file_mtime_seconds} seconds ago (maximum is ${_max_mtime_seconds})."
true > "${_file}" true > "${_file}"
chown -- "${xymon_username}":"${xymon_groupname}" "${_file}"
else else
[ "${debug}" -eq "0" ] && printf "${c_magentab}%-6b${c_reset}\n" "DEBUG: regenerate_if_too_old func Don't need to empty ${_file} last modification happened ${_file_mtime_seconds} seconds ago (maximum is ${_max_mtime_seconds})." [ "${debug}" -eq "0" ] && printf "${c_magentab}%-6b${c_reset}\n" "DEBUG: regenerate_if_too_old func Don't need to empty ${_file} last modification happened ${_file_mtime_seconds} seconds ago (maximum is ${_max_mtime_seconds})."
fi fi
@ -160,7 +164,9 @@ choose_correct_type() {
# Create or empty previous files # Create or empty previous files
true > "${plugin_result}" true > "${plugin_result}"
chown -- "${xymon_username}":"${xymon_groupname}" "${plugin_result}"
true > "${plugin_state}" true > "${plugin_state}"
chown -- "${xymon_username}":"${xymon_groupname}" "${plugin_state}"
## Create or empty previous file only if older than 24h (1440 minutes) ## Create or empty previous file only if older than 24h (1440 minutes)
regenerate_if_too_old "${device_list}" 1440 regenerate_if_too_old "${device_list}" 1440
regenerate_if_too_old "${drivedb_list}" 1440 regenerate_if_too_old "${drivedb_list}" 1440