Fix taskwarrior sync hook
This commit is contained in:
25
.local/share/task/hooks/on-add.sync
Executable file
25
.local/share/task/hooks/on-add.sync
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Inspired by https://gist.github.com/primeapple/d3d82fbd28e9134d24819dd72430888e
|
||||
|
||||
read new_task
|
||||
|
||||
source ~/.env
|
||||
|
||||
log_file=./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 &
|
||||
|
||||
echo $new_task
|
||||
echo 'on-add'
|
||||
|
||||
exit 0
|
||||
26
.local/share/task/hooks/on-modify.sync
Executable file
26
.local/share/task/hooks/on-modify.sync
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Inspired by https://gist.github.com/primeapple/d3d82fbd28e9134d24819dd72430888e
|
||||
|
||||
read original_task
|
||||
read modified_task
|
||||
|
||||
source ~/.env
|
||||
|
||||
log_file=./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 &
|
||||
|
||||
echo $modified_task
|
||||
echo 'on-modify'
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user