autosysadmin-agent: upstream release 24.03
This commit is contained in:
parent
c333970606
commit
037ec9d376
|
@ -13,7 +13,7 @@ The **patch** part changes is incremented if multiple releases happen the same m
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
* autosysadmin-agent: upstream release 24.02.3
|
* autosysadmin-agent: upstream release 24.03
|
||||||
* certbot: Renewal hook for NRPE
|
* certbot: Renewal hook for NRPE
|
||||||
* kvm-host: add minifirewall rules if DRBD interface is configured
|
* kvm-host: add minifirewall rules if DRBD interface is configured
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
VERSION="24.02.3"
|
VERSION="24.03"
|
||||||
|
|
||||||
# Common functions for "repair" and "restart" scripts
|
# Common functions for "repair" and "restart" scripts
|
||||||
|
|
||||||
|
@ -37,22 +37,31 @@ initialize() {
|
||||||
RUN_ID="$(date +"%Y-%m-%d_%H-%M")_${PROGNAME}_${PID}"
|
RUN_ID="$(date +"%Y-%m-%d_%H-%M")_${PROGNAME}_${PID}"
|
||||||
readonly RUN_ID
|
readonly RUN_ID
|
||||||
|
|
||||||
|
# Main log directory
|
||||||
|
MAIN_LOG_DIR="/var/log/autosysadmin"
|
||||||
|
readonly MAIN_LOG_DIR
|
||||||
|
# shellcheck disable=SC2174
|
||||||
|
mkdir --mode=750 --parents "${MAIN_LOG_DIR}"
|
||||||
|
chgrp adm "${MAIN_LOG_DIR}"
|
||||||
|
|
||||||
# Each execution store some information
|
# Each execution store some information
|
||||||
# in a unique directory based on the RUN_ID
|
# in a unique directory based on the RUN_ID
|
||||||
LOG_DIR="/var/log/autosysadmin/${RUN_ID}"
|
RUN_LOG_DIR="${MAIN_LOG_DIR}/${RUN_ID}"
|
||||||
readonly LOG_DIR
|
readonly RUN_LOG_DIR
|
||||||
mkdir -p "${LOG_DIR}"
|
# shellcheck disable=SC2174
|
||||||
|
mkdir --mode=750 --parents "${RUN_LOG_DIR}"
|
||||||
|
chgrp adm "${RUN_LOG_DIR}"
|
||||||
|
|
||||||
# This log file contains all events
|
# This log file contains all events
|
||||||
LOG_FILE="${LOG_DIR}/autosysadmin.log"
|
RUN_LOG_FILE="${RUN_LOG_DIR}/autosysadmin.log"
|
||||||
readonly LOG_FILE
|
readonly RUN_LOG_FILE
|
||||||
|
|
||||||
# This log file contains notable actions
|
# This log file contains notable actions
|
||||||
ACTIONS_FILE="${LOG_DIR}/actions.log"
|
ACTIONS_FILE="${RUN_LOG_DIR}/actions.log"
|
||||||
readonly ACTIONS_FILE
|
readonly ACTIONS_FILE
|
||||||
touch "${ACTIONS_FILE}"
|
touch "${ACTIONS_FILE}"
|
||||||
# This log file contains abort reasons (if any)
|
# This log file contains abort reasons (if any)
|
||||||
ABORT_FILE="${LOG_DIR}/abort.log"
|
ABORT_FILE="${RUN_LOG_DIR}/abort.log"
|
||||||
readonly ABORT_FILE
|
readonly ABORT_FILE
|
||||||
# touch "${ABORT_FILE}"
|
# touch "${ABORT_FILE}"
|
||||||
|
|
||||||
|
@ -91,7 +100,7 @@ initialize() {
|
||||||
test -f /etc/evolinux/autosysadmin && source /etc/evolinux/autosysadmin
|
test -f /etc/evolinux/autosysadmin && source /etc/evolinux/autosysadmin
|
||||||
|
|
||||||
log_all "Begin ${PROGNAME} RUN_ID: ${RUN_ID}"
|
log_all "Begin ${PROGNAME} RUN_ID: ${RUN_ID}"
|
||||||
log_all "Log directory is ${LOG_DIR}"
|
log_all "Log directory is ${RUN_LOG_DIR}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Executes a list of tasks before exiting:
|
# Executes a list of tasks before exiting:
|
||||||
|
@ -561,7 +570,7 @@ log_run() {
|
||||||
|
|
||||||
printf "[%s] %s[%s]: %s\\n" \
|
printf "[%s] %s[%s]: %s\\n" \
|
||||||
"${date}" "${PROGNAME}" "${PID}" "${msg}" \
|
"${date}" "${PROGNAME}" "${PID}" "${msg}" \
|
||||||
>> "${LOG_FILE}"
|
>> "${RUN_LOG_FILE}"
|
||||||
}
|
}
|
||||||
# Log a message in the system log file (syslog or journald)
|
# Log a message in the system log file (syslog or journald)
|
||||||
log_global() {
|
log_global() {
|
||||||
|
@ -622,7 +631,7 @@ print_abort_reasons() {
|
||||||
}
|
}
|
||||||
# Print the content of the main log from the log directory
|
# Print the content of the main log from the log directory
|
||||||
print_main_log() {
|
print_main_log() {
|
||||||
cat "${LOG_FILE}"
|
cat "${RUN_LOG_FILE}"
|
||||||
}
|
}
|
||||||
# Log an abort reason and quit the script
|
# Log an abort reason and quit the script
|
||||||
log_abort_and_quit() {
|
log_abort_and_quit() {
|
||||||
|
@ -634,7 +643,7 @@ log_abort_and_quit() {
|
||||||
# into a file in the log directory named after the 1st parameter
|
# into a file in the log directory named after the 1st parameter
|
||||||
save_in_log_dir() {
|
save_in_log_dir() {
|
||||||
local file_name=$1
|
local file_name=$1
|
||||||
local file_path="${LOG_DIR}/${file_name}"
|
local file_path="${RUN_LOG_DIR}/${file_name}"
|
||||||
|
|
||||||
cat /dev/stdin > "${file_path}"
|
cat /dev/stdin > "${file_path}"
|
||||||
|
|
||||||
|
@ -643,7 +652,7 @@ save_in_log_dir() {
|
||||||
# Return the full path of the file in log directory
|
# Return the full path of the file in log directory
|
||||||
# based on the name in the 1st parameter
|
# based on the name in the 1st parameter
|
||||||
file_path_in_log_dir() {
|
file_path_in_log_dir() {
|
||||||
echo "${LOG_DIR}/${1}"
|
echo "${RUN_LOG_DIR}/${1}"
|
||||||
}
|
}
|
||||||
|
|
||||||
format_mail_success() {
|
format_mail_success() {
|
||||||
|
@ -731,7 +740,7 @@ print_report_information() {
|
||||||
echo ""
|
echo ""
|
||||||
echo "**Utilisateurs récents**"
|
echo "**Utilisateurs récents**"
|
||||||
echo ""
|
echo ""
|
||||||
who_file=$(file_path_in_log_dir "server-state/df.txt")
|
who_file=$(file_path_in_log_dir "who-users")
|
||||||
if [ -s "${who_file}" ]; then
|
if [ -s "${who_file}" ]; then
|
||||||
cat "${who_file}"
|
cat "${who_file}"
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
: "${AUTOSYSADMIN_LIB:=/usr/local/lib/autosysadmin}"
|
|
||||||
source "${AUTOSYSADMIN_LIB}/common.sh" || exit 1
|
|
||||||
source "${AUTOSYSADMIN_LIB}/repair.sh" || exit 1
|
|
||||||
|
|
||||||
pre_repair
|
|
||||||
|
|
||||||
# shellcheck source=./restart_amavis.sh
|
|
||||||
source /usr/share/scripts/autosysadmin/auto/restart_amavis.sh
|
|
||||||
|
|
||||||
restart_amavis
|
|
||||||
|
|
||||||
sendmail success
|
|
||||||
|
|
||||||
post_repair
|
|
|
@ -3,7 +3,7 @@ Autosysadmin "restart auto" scripts
|
||||||
|
|
||||||
In this directory you can place scripts that will be executed automatically by a cron job (stored in `/etc/cron.d/autosysadmin`).
|
In this directory you can place scripts that will be executed automatically by a cron job (stored in `/etc/cron.d/autosysadmin`).
|
||||||
|
|
||||||
They must satisfy the default `run-parts(8)` constaints :
|
They must satisfy the default `run-parts(8)` constraints :
|
||||||
|
|
||||||
* be "executable"
|
* be "executable"
|
||||||
* belong to the Debian cron script namespace (`^[a-zA-Z0-9_-]+$`), example: `restart_amavis`
|
* belong to the Debian cron script namespace (`^[a-zA-Z0-9_-]+$`), example: `restart_amavis`
|
||||||
|
|
Loading…
Reference in a new issue