X-Git-Url: https://git.madduck.net/etc/offlineimap.git/blobdiff_plain/32439eadb0bc1861dd450133bfcf9467a996de3d..c568707d316118250478115ebd46e88e6b1d59ae:/.bin/offlineimap diff --git a/.bin/offlineimap b/.bin/offlineimap index 789fbe4..f55fee5 100755 --- a/.bin/offlineimap +++ b/.bin/offlineimap @@ -1,6 +1,16 @@ #!/bin/sh set -eu +[ "${1:-}" = -q ] && exec >/dev/null + +VAR=$HOME/.var/offlineimap +LOCKFILE="$VAR/.cron.lock" +trap "rm -f $LOCKFILE" 0 1 2 3 4 5 6 7 8 10 11 12 13 14 15 +if ! lockfile -0 -r0 -l 3600 "$LOCKFILE" 2>/dev/null; then + echo "E: offlineimap is already running." >&2 + exit 1 +fi + if ! test -t 0; then echo Renicing because we are not run interactively… >&2 renice 20 -p $$ >/dev/null