Skip to content

Instantly share code, notes, and snippets.

@Falkor
Created July 16, 2018 14:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Falkor/e731dd99d895d34ce82d8d255cabfb28 to your computer and use it in GitHub Desktop.
Save Falkor/e731dd99d895d34ce82d8d255cabfb28 to your computer and use it in GitHub Desktop.
Wrapper over bugwarrior-pull to sustain stalled cron runs
#! /bin/bash
################################################################################
# do_bugwarrior_pull.sh - Perform the 'bugwarrior-pull' command
# See https://bugwarrior.readthedocs.io
# Time-stamp: <Wed 2017-11-22 14:58 svarrette>
#
# Copyright (c) 2017 Sebastien Varrette <Sebastien.Varrette@uni.lu>
################################################################################
LOCKFILE=$HOME/.config/task/bugwarrior.lockfile
if [ -f "${LOCKFILE}" ]; then
# test if the file is present for at least ${ALLOWED_WAITING_TIME} hour(s)
ALLOWED_WAITING_TIME=2
tmptest=$(find . -mmin +$((60*${ALLOWED_WAITING_TIME})) | grep ${LOCKFILE})
if [ $? -eq 0 ]; then
echo "/!\ WARNING: deleting old (obsolete?) lock file '${LOCKFILE}'"
rm -f ${LOCKFILE}
fi
fi
if [ -n "$(which bugwarrior-pull)" ]; then
bugwarrior-pull
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment