23 lines
625 B
Bash
23 lines
625 B
Bash
#!/bin/sh
|
|||
|
|
# Config -> Sync net time: force an immediate NTP sync and show the outcome.
|
||
|
|
# Runs as the X session user; bananarchy-time-sync.sh escalates via doas.
|
||
|
|
set -u
|
||
|
|
|
||
|
|
result="$(/usr/bin/bananarchy-time-sync.sh sync 2>&1)"
|
||
|
|
[ -n "$result" ] || result="No response from chronyd"
|
||
|
|
|
||
|
|
case "$result" in
|
||
|
|
"Network time synced"*)
|
||
|
|
urgency=normal
|
||
|
|
;;
|
||
|
|
*)
|
||
|
|
urgency=critical
|
||
|
|
;;
|
||
|
|
esac
|
||
|
|
|
||
|
|
if command -v notify-send >/dev/null 2>&1; then
|
||
|
|
notify-send --urgency="$urgency" --expire-time=8000 \
|
||
|
|
"Sync net time" "$result" >/dev/null 2>&1 || true
|
||
|
|
else
|
||
|
|
sxmo_notify_user.sh "Sync net time: $result" >/dev/null 2>&1 || true
|
||
|
|
fi
|