AutoYADM commit: 2025-06-17 20:47:57
This commit is contained in:
parent
1f952af0ed
commit
80c399ee03
16 changed files with 476 additions and 131 deletions
|
@ -1,5 +1,12 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Hook for Taskwarrior to automaticaly sync.
|
||||
# If the state has been modified, we fork into the background
|
||||
# and run task sync. If the command fails, then we spawn an
|
||||
# urgent desktop notification, and use sendmail to send ourselves
|
||||
# an email with an error log. For this to work, sendmail must
|
||||
# be configured with capability to send emails from our account.
|
||||
|
||||
DATA="$HOME/.local/share/task"
|
||||
|
||||
n=0
|
||||
|
@ -13,7 +20,9 @@ if [ "$n" -gt 0 ]; then
|
|||
errfile="$DATA/sync_hook.err"
|
||||
lerrfile="$DATA/sync_hook.errl"
|
||||
logfile="$DATA/sync_hook.log"
|
||||
address='daniel@ficd.ca'
|
||||
|
||||
# shellcheck disable=SC2016
|
||||
flock "$lockfile" sh -c '
|
||||
task sync >>"$1" 2>"$2"
|
||||
status=$?
|
||||
|
@ -22,8 +31,8 @@ if [ "$n" -gt 0 ]; then
|
|||
|
||||
if command -v sendmail >/dev/null 2>&1; then
|
||||
{
|
||||
echo "To: daniel@ficd.ca"
|
||||
echo "From: daniel@ficd.ca"
|
||||
echo "To: $5"
|
||||
echo "From: $5"
|
||||
echo "Subject: Taskwarrior Sync Failed on $(hostname)"
|
||||
echo "Date: $(date -R)"
|
||||
echo ""
|
||||
|
@ -41,9 +50,8 @@ if [ "$n" -gt 0 ]; then
|
|||
|
||||
exit 1
|
||||
fi
|
||||
' sh "$logfile" "$lerrfile" "$errfile" "$(hostname)"
|
||||
' sh "$logfile" "$lerrfile" "$errfile" "$(hostname)" "$address"
|
||||
} >/dev/null 2>&1 </dev/null &
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue