From f6d39c51574047ec8aafda5e3af33af0ce3a81f9 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Mon, 04 Jun 2018 20:49:17 -0400 Subject: .config/offlineimap/cron: Attempt to log into correct host --- (limited to '.config/offlineimap/cron') diff --git a/.config/offlineimap/cron b/.config/offlineimap/cron index 592b2a5..635a65e 100755 --- a/.config/offlineimap/cron +++ b/.config/offlineimap/cron @@ -4,13 +4,13 @@ set -eu reap_proc() { - local host="${1}" + local domn="${1}" local user="${2}" shift 2 local pid= local t=0 - { read -r pid <~/".cache/offlineimap/Account-${host}-${user}.pid"; } \ + { read -r pid <~/".cache/offlineimap/Account-${domn}-${user}.pid"; } \ 2>/dev/null || return 0 while ps -p ${pid} -o cmd | grep -Fq offlineimap; do @@ -27,8 +27,8 @@ reap_proc() ping_srvr() { - local host="${1}" - local user="${2}" + local user="${1}" + local host="${2}" shift 2 # ping -c 1 -W 10 "${host}" || return 1 @@ -39,16 +39,17 @@ ping_srvr() sync() { - local host="${1}" + local domn="${1}" local user="${2}" - shift 2 - - reap_proc "${host}" "${user}" || return 1 - ping_srvr "${host}" "${user}" || return 1 - offlineimap -a "${host}-${user}" \ - 1>>~/".cache/offlineimap/Account-${host}-${user}.log" 2>&1 & - printf '%d\n' ${!} >~/".cache/offlineimap/Account-${host}-${user}.pid" + local host="${3}" + shift 3 + + reap_proc "${domn}" "${user}" || return 1 + ping_srvr "${user}" "${host}" || return 1 + offlineimap -a "${domn}-${user}" \ + 1>>~/".cache/offlineimap/Account-${domn}-${user}.log" 2>&1 & + printf '%d\n' ${!} >~/".cache/offlineimap/Account-${domn}-${user}.pid" } -#sync 'pehjota.net' 'pj' || : -sync 'libiquity.com' 'patrick.mcdermott' || : +#sync 'pehjota.net' 'pj' 'mail.pehjota.net' || : +sync 'libiquity.com' 'patrick.mcdermott' 'mail.libiquity.com' || : -- cgit v0.9.1