Package: getmail4 Version: 4.53.0-1 Severity: wishlist Tags: patch Attached is an improved (IMO) version of /usr/bin/getmails that launches a separate getmail process for each config file, in parallel, and then waits for them to all complete, exiting with the "worst" (greatest) exit code of any of the individual instances.
I wrote this for myself because I'm using it to keep a backup of a couple gmail accounts that are now, for some reason, taking nearly 30 minutes each just to enumerate the list of messages (I have a feeling I may have hit some overuse throttle at Google since the message list data is coming down at dialup speeds). Loosely relates to #863856, but does not implement that suggestion. Also not handled (at least not in any pretty way) is what happens if you run it with no getmail configs in the specified directory. -- System Information: Debian Release: 9.1 APT prefers stable APT policy: (990, 'stable'), (500, 'unstable-debug'), (500, 'stable-debug'), (500, 'unstable'), (500, 'testing'), (1, 'experimental-debug'), (1, 'experimental') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 4.9.0-3-amd64 (SMP w/8 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) Versions of packages getmail4 depends on: ii python 2.7.13-2 getmail4 recommends no packages. getmail4 suggests no packages. -- no debconf information
#!/bin/sh # vim:se tw=78 sts=4: # Copyright (C) Osamu Aoki <os...@debian.org>, GPL2+ set -e UID_BY_ID=$(id -u) PID_GETMAILS=$(pgrep -U $UID_BY_ID '^getmails$') if [ "x$PID_GETMAILS" != "x$$" ]; then echo "The getmails script is already running as PID=\"$PID_GETMAILS\" ." >&2 exit 1 fi if [ -f $HOME/.getmail/stop ]; then echo "Do not run getmail ... (if not, remove $HOME/.getmail/stop)" >&2 exit 1 fi pids="" rcfiles="/usr/bin/getmail" for file in $HOME/.getmail/config/* ; do /usr/bin/getmail --rcfile "$file" & pids="$pids $!" done rc=0 if [ -n "$pids" ]; then for pid in $pids ; do wait $pid prc=$? if [ $prc -gt $rc ]; then rc=$prc fi done fi exit $rc