Skip to content

Instantly share code, notes, and snippets.

@marchbnr
Created February 14, 2018 08:02
Show Gist options
  • Save marchbnr/6bc4e847da16c53133df16155280699a to your computer and use it in GitHub Desktop.
Save marchbnr/6bc4e847da16c53133df16155280699a to your computer and use it in GitHub Desktop.
Automatically sync taskwarrior
#!/bin/bash
# This hooks script syncs task warrior to the configured task server.
# The on-exit event is triggered once, after all processing is complete.
# Make sure hooks are enabled
LOCK_FILE=~/.task/autosync.lock
if [ ! -f $LOCK_FILE ]; then
touch $LOCK_FILE
# Only sync, if the backlog is not empty
if ((`cat ~/.task/backlog.data | wc -l` > 1)); then
task sync >> ~/.task/sync_hook.log
fi
rm $LOCK_FILE
fi
exit 0
@sdondley
Copy link

What's the best way to trigger this? With a cron? Or is there a way to trigger it after running at taskwarrior command?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment