Skip to content

Commit

Permalink
feat: add backup alert functionality
Browse files Browse the repository at this point in the history
This commit adds a new function `fn_alert_backup` to the `alert.sh` module. This function sends an alert when the system has been backed up. The alert includes a message, action, emoji, sound, and color.

In addition, this commit modifies the `command_backup.sh` module to trigger the backup alert by setting the variable `alert` to "backup" and calling `alert.sh`.

The purpose of these changes is to provide notifications when backups are created.

Co-authored-by: AI Assistant <[email protected]>
  • Loading branch information
dgibbs64 and AI Assistant committed Oct 21, 2023
1 parent f4988db commit 233afd3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lgsm/modules/alert.sh
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,17 @@ fn_alert_update_linuxgsm() {
alertcolourdec="52480"
}

fn_alert_backup() {
fn_script_log_info "Sending alert: ${selfname} has been backed up"
alertaction="Backed Up"
alertemoji="📂"
alertsound="1"
alertmessage="${selfname} has been backed up."
# Green
alertcolourhex="#00cd00"
alertcolourdec="52480"
}

fn_alert_permissions() {
fn_script_log_info "Sending alert: ${selfname} has permissions issues"
alertaction="Checked Permissions"
Expand Down Expand Up @@ -204,6 +215,8 @@ elif [ "${alert}" == "restarted" ]; then
fn_alert_restarted
elif [ "${alert}" == "update-linuxgsm" ]; then
fn_alert_update_linuxgsm
elif [ "${alert}" == "backup" ]; then
fn_alert_backup
else
fn_print_fail_nl "Missing alert type"
fn_script_log_fatal "Missing alert type"
Expand Down
2 changes: 2 additions & 0 deletions lgsm/modules/command_backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ fn_backup_compression() {
fn_print_ok_eol
fn_print_ok_nl "Completed: ${backupname}.tar.gz, total size $(du -sh "${backupdir}/${backupname}.tar.gz" | awk '{print $1}')"
fn_script_log_pass "Backup created: ${backupname}.tar.gz, total size $(du -sh "${backupdir}/${backupname}.tar.gz" | awk '{print $1}')"
alert="backup"
alert.sh
fi
}

Expand Down

0 comments on commit 233afd3

Please sign in to comment.