Browse Source

feat: add backup alert functionality

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 <assistant@example.com>
pull/4345/head
Daniel Gibbs 2 years ago
parent
commit
233afd3efd
No known key found for this signature in database GPG Key ID: 2076B128385E8C55
  1. 13
      lgsm/modules/alert.sh
  2. 2
      lgsm/modules/command_backup.sh

13
lgsm/modules/alert.sh

@ -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"
@ -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"

2
lgsm/modules/command_backup.sh

@ -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
}

Loading…
Cancel
Save