Skip to content

Commit

Permalink
Improve keepalived alert script and add some comments (#139)
Browse files Browse the repository at this point in the history
At the ICPC WFs in Egypt the correct sound card to use is 0;
just try to set the volume on both 0 and 1. Also try beep and send
a desktop notification.

Co-authored-by: DOMjudge team <[email protected]>
  • Loading branch information
meisterT and DOMjudge team authored May 6, 2024
1 parent f8d19ff commit f92a099
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
#!/bin/sh
#!/bin/bash

# Try a couple of different notification methods.

notify-send -u critical -t 60000 "Alert: keepalived status changed at $(date '+%T') !"

amixer -c 0 set Master 100%
amixer -c 1 set Master 100%

for i in 1 2 3 4 5 6 7 8 9 10 ; do
aplay /usr/share/sounds/sound-icons/pipe.wav
done

beep -f 500 -l 400 -d 100 -r 4
beep -f 1000 -l 400 -d 100 -r 4
beep -f 500 -l 200 -d 100 -r 6
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
#!/bin/sh

# This only copies the script below which contains alerting code
# A desktop autostart application started the alert_listener.sh
# script, which then detects the copy and executes it.

cp ~/bin/alerting.sh.template ~/alerting.sh
3 changes: 2 additions & 1 deletion provision-contest/ansible/roles/keepalived/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
---
# These tasks install keepalived with IP failover

- name: Install keepalived
- name: Install keepalived and beep (for alerting)
apt:
state: present
pkg:
- keepalived
- beep

- name: Configure keepalived for domjudge IP failover
template:
Expand Down

0 comments on commit f92a099

Please sign in to comment.