Skip to content

Commit

Permalink
refactor: improve backup and update monitoring
Browse files Browse the repository at this point in the history
The code in `command_monitor.sh` has been refactored to enhance the monitoring of backups and updates. The conditions for checking if a backup or update is running have been modified to include additional checks using `pgrep`. This change improves the accuracy of the monitoring process.
  • Loading branch information
dgibbs64 committed Jul 29, 2023
1 parent 0e8e1a3 commit e871833
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lgsm/modules/command_monitor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ fn_monitor_check_backup() {
fi

# Monitor will check if backup is running.
if [ -f "${lockdir}/backup.lock" ]; then
if [ -f "${lockdir}/backup.lock" ] && [[ "$(pgrep -fc -u "${USER}" "${selfname} backup")" != "0" || "$(pgrep -fc -u "${USER}" "${selfname} b")" != "0" ]]; then
fn_print_info "Checking backup: LinuxGSM is currently running a backup: "
fn_print_info_eol
fn_script_log_info "Checking backup: LinuxGSM is currently running a backup"
Expand All @@ -87,7 +87,7 @@ fn_monitor_check_update() {
fi
fi

if [ -f "${lockdir}/${selfname}-update.lock" ]; then
if [ -f "${lockdir}/${selfname}-update.lock" ] && [[ "$(pgrep -fc -u "${USER}" "${selfname} update")" != "0" || "$(pgrep -fc -u "${USER}" "${selfname} validate")" != "0" || "$(pgrep -fc -u "${USER}" "${selfname} v")" != "0" || "$(pgrep -fc force-update "${USER}" "${selfname} fu")" != "0" ]]; then
fn_print_info_nl "Checking update: LinuxGSM is currently updating: "
fn_print_info_eol
fn_script_log_pass "Checking update: LinuxGSM is currently updating"
Expand Down

0 comments on commit e871833

Please sign in to comment.