Created
January 18, 2016 07:46
-
-
Save mturquette/0237243502b3fe5d142f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*/15 * * * * ~/.local/bin/mail.cron |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
PID=$(pgrep offlineimap) | |
LOCK=/var/lock/mail | |
# offlineimap freezes up a lot. kill if previous job is still running | |
[[ -n "$PID" ]] && kill $PID | |
# sub-shell below is locked to prevent concurrency | |
( | |
# bail early if lock is held | |
flock -n 9 || exit 1 | |
/usr/bin/offlineimap -o -a baylibre -u basic | /usr/bin/logger | |
) 9>$LOCK | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment