- Global uniform pass: the $logs_dir/$docker_log_file log-append idiom (always /docker/logs, data-plane) -> runFileWrite -a across runtime files (check_success.sh logging backbone + several app scripts). - monitoring.sh fully converted: containers_dir/docker_dir file ops (sqlite3/sed/mkdir/cp/rm/chmod/find, grafana tee-heredocs) -> runFileOp/ runFileWrite; prometheus/grafana docker ps/kill/restart -> dockerCommandRun. Byte-identical in rooted (all helpers reduce to sudo there). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> Signed-off-by: librelad <librelad@digitalangels.vip>
54 lines
2.0 KiB
Bash
Executable File
54 lines
2.0 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
function checkSuccess()
|
|
{
|
|
if [ $? -eq 0 ]; then
|
|
isSuccessful "$1"
|
|
if [ -f "$logs_dir/$docker_log_file" ]; then
|
|
echo "✓ Success $1" | runFileWrite -a "$logs_dir/$docker_log_file" >/dev/null
|
|
fi
|
|
else
|
|
isError "$1"
|
|
|
|
# Non-interactive (task processor / cron / piped): bail instead of
|
|
# blocking on read.
|
|
if [[ "$LIBREPORTAL_NONINTERACTIVE" == "1" ]] || [ ! -t 0 ]; then
|
|
if [ -f "$logs_dir/$docker_log_file" ]; then
|
|
isError " $1" | runFileWrite -a "$logs_dir/$docker_log_file" >/dev/null
|
|
echo "===================================" | runFileWrite -a "$logs_dir/$docker_log_file" >/dev/null
|
|
fi
|
|
isNotice "Non-interactive mode: aborting on error."
|
|
exit 1
|
|
fi
|
|
|
|
while true; do
|
|
isQuestion "An error has occurred. Do you want to continue, exit or go to back to the Menu? (c/x/m) "
|
|
read -rp "" error_occurred
|
|
if [[ -n "$error_occurred" ]]; then
|
|
break
|
|
fi
|
|
isNotice "Please provide a valid input."
|
|
done
|
|
|
|
if [[ "$error_occurred" == [cC] ]]; then
|
|
isNotice "Continuing after error has occurred."
|
|
fi
|
|
|
|
if [[ "$error_occurred" == [xX] ]]; then
|
|
# Log the error output to the log file
|
|
isError " $1" | runFileWrite -a "$logs_dir/$docker_log_file"
|
|
echo "===================================" | runFileWrite -a "$logs_dir/$docker_log_file"
|
|
exit 1 # Exit the script with a non-zero status to stop the current action
|
|
fi
|
|
|
|
if [[ "$error_occurred" == [mM] ]]; then
|
|
# Log the error output to the log file
|
|
isError " $1" | runFileWrite -a "$logs_dir/$docker_log_file"
|
|
echo "===================================" | runFileWrite -a "$logs_dir/$docker_log_file"
|
|
if [[ "$initial_command2" == "terminal" ]]; then
|
|
resetToMenu;
|
|
fi
|
|
fi
|
|
fi
|
|
}
|