Improve taskwarrior sync setup

This commit is contained in:
2023-04-14 17:34:14 +02:00
parent f615055adb
commit 0cbab089bd
5 changed files with 61 additions and 14 deletions

20
.task/hooks/on-exit.sync.sh Executable file
View File

@@ -0,0 +1,20 @@
#!/bin/sh
# Inspired by https://gist.github.com/primeapple/d3d82fbd28e9134d24819dd72430888e
source ~/.env
log_file=~/.task/sync.log
is_up() {
if ! nc -z $TASKD_SERVER $TASKD_PORT; then
echo "Server is down" >> $log_file
exit 1
fi
}
is_up
date > $log_file
task rc.verbose:nothing sync >> $log_file &
exit 0