Fix taskwarrior sync hook
parent
e074d94e5f
commit
4aef6038ab
|
@ -1,5 +1,5 @@
|
||||||
data.location=$XDG_DATA_HOME/task/
|
data.location=$XDG_DATA_HOME/task/
|
||||||
hooks.location=$XDG_CONFIG_HOME/task/hooks/
|
hooks.location=$XDG_DATA_HOME/task/hooks
|
||||||
|
|
||||||
include ./taskrc.d/server
|
include ./taskrc.d/server
|
||||||
include /usr/share/doc/task/rc/light-256.theme
|
include /usr/share/doc/task/rc/light-256.theme
|
||||||
|
|
|
@ -2,9 +2,11 @@
|
||||||
|
|
||||||
# Inspired by https://gist.github.com/primeapple/d3d82fbd28e9134d24819dd72430888e
|
# Inspired by https://gist.github.com/primeapple/d3d82fbd28e9134d24819dd72430888e
|
||||||
|
|
||||||
|
read new_task
|
||||||
|
|
||||||
source ~/.env
|
source ~/.env
|
||||||
|
|
||||||
log_file=~/.task/sync.log
|
log_file=./sync.log
|
||||||
|
|
||||||
is_up() {
|
is_up() {
|
||||||
if ! nc -z $TASKD_SERVER $TASKD_PORT; then
|
if ! nc -z $TASKD_SERVER $TASKD_PORT; then
|
||||||
|
@ -17,4 +19,7 @@ is_up
|
||||||
date > $log_file
|
date > $log_file
|
||||||
task rc.verbose:nothing sync >> $log_file &
|
task rc.verbose:nothing sync >> $log_file &
|
||||||
|
|
||||||
|
echo $new_task
|
||||||
|
echo 'on-add'
|
||||||
|
|
||||||
exit 0
|
exit 0
|
|
@ -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
|
Loading…
Reference in New Issue